问题原文
原帖链接 · jersey bean · CC BY-SA 4.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.
已采纳解答
原帖链接 · SYN · CC BY-SA 4.0
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 will first have to use some gcloud container clusters get-credentials command.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
