Google Cloud Platform 项目的 gcloud 配置更改时,kubectl 没有更改配置

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

我使用 gcloud config set project abcxyz 切换了 gcloud 的项目配置,但是 kubectl get pods 返回了之前 gcloud / kubernetes 项目中的 pods。

如何更新项目配置以匹配 gcloud 的配置?

更改项目后,运行:

gcloud container clusters get-credentials <cluster_name>

然后 gcloud 将设置 kubectl 来查看您的新项目。