kubectl does not have config changed when gcloud config changes for Google Cloud Platform project

8/3/2017

I switched the project config for gcloud using gcloud config set project abcxyz, however kubectl get pods is returning the pods in the previous gcloud / kubernetes project.

How do I update the project config to match gcloud's config?

-- Chris Stryczynski
gcloud
google-cloud-platform
kubectl
kubernetes

1 Answer

8/4/2017

After you've changed project, run:

gcloud container clusters get-credentials <cluster_name>

gcloud will then set kubectl to be looking at your new project.

-- sharif9876
Source: StackOverflow