gcp auth插件已被弃用,如何跳过此错误?

gcp auth插件已被弃用,如何跳过此错误?

我已经在测试帐户上安装了 gke 并配置了 cli。

kuebctl get pods 

发出以下警告。

W0916 17:23:58.063534   67381 gcp.go:119] WARNING: the gcp auth plugin is deprecated in v1.22+, unavailable in v1.26+; use gcloud instead.
To learn more, consult https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke
No resources found in default namespace.

但是我已经安装了 gcloud-auth-plugin

sudo apt-get install google-cloud-sdk-gke-gcloud-auth-plugin
Reading package lists... Done
Building dependency tree
Reading state information... Done
google-cloud-sdk-gke-gcloud-auth-plugin is already the newest version (402.0.0-0).
0 upgraded, 0 newly installed, 0 to remove and 61 not upgraded.

但为什么我还是会收到这个警告?有什么建议可以解决这个问题吗?

gke-gcloud-auth-plugin --version
Kubernetes v1.24.0-alpha+f42d1572e39979f6f7de03bd163f8ec04bc7950d

答案1

您需要确保已安装插件并设置:

USE_GKE_GCLOUD_AUTH_PLUGIN=True

适用于您的环境。然后运行:

gcloud container clusters get-credentials ...

运行任何 kubectl 命令时都应出现警告。

相关内容