How to use inclusterconfig for multiple clusters

3/22/2020

How can we use inclusterconfig for multiple clusters?

I tried below code for one cluster

rest.InclusterConfig

Can someone help me with this?

-- Pattapu S Vamsi
kubernetes
kubernetes-go-client

1 Answer

3/22/2020

It's not possible to use in cluster config to connect to a cluster which is not the current cluster where the pod is deployed because client-go uses the service account token (valid for the current cluster) mounted inside the pod at the /var/run/secrets/kubernetes.io/serviceaccount path when the rest.InClusterConfig() is used.

-- Arghya Sadhu
Source: StackOverflow