google kubernetes engine – How can I change the context of kubectl commands and helm?

First make sure the desired cluster is available to you

gcloud container clusters list

Now you need to reconcile that command (which has the data from Google) with your local kubectl, you can do that with

kubectl config get-contexts

If you do not see a matching context, you can add one. The following command adds the context and sets it as the current-context, which is weird for a command called “get-credentials” but that’s Google.

gcloud container clusters get-credentials myCluster --region=us-central1

But, if there is already a context in your kubectl that you merely want to switch to you can do that with

kubectl config use-context myContext

For more information see this link

Read more here: Source link