0

From client A, I created a new kubernetes cluster in GCP as follows:

$ gcloud container clusters create my-new-cluster --num-nodes 3

From client A, I can see the new context was created:

$ kubectl config get-contexts
CURRENT   NAME                                          CLUSTER                                       AUTHINFO                                      NAMESPACE
*         gke_learn-k8s-261120_us-west1-b_my-new-cluster   gke_learn-k8s-261120_us-west1-b_my-new-cluster   gke_learn-k8s-261120_us-west1-b_my-new-cluster   
          gke_learn-k8s-261120_us-west1-b_kubia         gke_learn-k8s-261120_us-west1-b_kubia         gke_learn-k8s-261120_us-west1-b_kubia         
          minikube                                      minikube                                      minikube        

But when I go over to client B and run 'kubectl config get-context', then I do not see the new context created:

$ kubectl config get-contexts
CURRENT   NAME                                    CLUSTER                                 AUTHINFO                                NAMESPACE
*         gke_learn-k8s-261120_us-west1-b_kubia   gke_learn-k8s-261120_us-west1-b_kubia   gke_learn-k8s-261120_us-west1-b_kubia   
          minikube                                minikube                                minikube     

I'm unable to find any documentation online on how to refresh or sync from GCP the client B with the latest clusters, nodes, pods, etc...

FWIW I'm also able to see the cluster from the GCP Platform through the browser.

Please help explain what is happening here and how client B is able to get the latest kubertnetes cluster from GCP.

1

The get-contexts command from kubectl only looks for clusters in your $HOME/.kube/config.

To add your new cluster in client B configuration, you'ld first have to use some gcloud container clusters get-credential command.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.