如何对多个集群使用 inclusterconfig

How to use inclusterconfig for multiple clusters

我们如何为多个集群使用 inclusterconfig?

我为一个集群尝试了以下代码

rest.InclusterConfig

有人可以帮我解决这个问题吗?

无法在集群配置中使用连接到不是部署 pod 的当前集群的集群,因为 client-go 使用安装在 pod 内的服务帐户令牌(对当前集群有效)使用 rest.InClusterConfig() 时的 /var/run/secrets/kubernetes.io/serviceaccount 路径。