k9s:无法连接到 kubernetes 集群

SRJ*_*SRJ 2 google-cloud-platform kubernetes

我正在使用 k9s 工具来管理 kubernetes 集群(Google Cloud Platform 上的 GKE)。

最近k9s停止工作并停止连接到k8s集群。

当我启动 k9s(即k9s -n default)时,它会显示所有集群的上下文,当我单击其中一个上下文时

错误是

Unable to connect to context "XXXXXXXXXX"
Run Code Online (Sandbox Code Playgroud)

它向我显示了以下错误,如屏幕截图所示。

在此输入图像描述

但是对于kubectl客户端来说,它工作正常并显示集群的所有数据。

我尝试重新安装 k9s 并更新其版本,但问题仍然存在。

如何调试问题并解决问题?

SRJ*_*SRJ 6

调查、检查日志后,您可以通过运行获取日志位置

\n
$ k9s info\xc2\xa0 \xc2\xa0 \xc2\xa0\n\n\xc2\xa0____\xc2\xa0 __.________\xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0\n\n|\xc2\xa0 \xc2\xa0 |/ _/ \xc2\xa0 __ \xc2\xa0 \\______\n\n|\xc2\xa0 \xc2\xa0 \xc2\xa0 < \\____\xc2\xa0 \xc2\xa0 /\xc2\xa0 ___/\n\n|\xc2\xa0 \xc2\xa0 |\xc2\xa0 \\ \xc2\xa0 /\xc2\xa0 \xc2\xa0 /\\___ \\\xc2\xa0\n\n|____|__ \\ /____//____\xc2\xa0 >\n\n\xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \\/\xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \\/\xc2\xa0\n\n  \n\nConfiguration: \xc2\xa0 /Users/xyx/Library/Applications/k9s/config.yml\n\nLogs:\xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 /var/folders/8r/t5bx6ckdchjdacj3nz7qyq0b4ys7mwh0000gp/T/k9s-shubcbsj.log\n\nScreen Dumps:\xc2\xa0 \xc2\xa0 /var/folders/8r/t5bx6ckdchjdacj3nz7qyq0b4ys7mwh0000gp/T/k9s-screens-chakhcahkcha\n
Run Code Online (Sandbox Code Playgroud)\n

日志向我显示了这个错误。

\n
9:08PM ERR Unable to connect to api server error="The gcp auth plugin has been removed.\\nPlease use the \\"gke-gcloud-auth-plugin\\" kubectl/client-go credential plugin instead.\\nSee https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke for further details"\n9:08PM ERR ClusterUpdater failed error="Conn check failed (1/5)"\n9:08PM ERR Unable to connect to api server error="The gcp auth plugin has been removed.\\nPlease use the \\"gke-gcloud-auth-plugin\\" kubectl/client-go credential plugin instead.\\nSee https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke for further details"\n9:08PM ERR ClusterUpdater failed error="Conn check failed (2/5)"\n9:08PM ERR Unable to connect to api server error="The gcp auth plugin has been removed.\\nPlease use the \\"gke-gcloud-auth-plugin\\" kubectl/client-go credential plugin instead.\\nSee https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke for further details"\n9:08PM ERR ClusterUpdater failed error="Conn check failed (3/5)"\n9:08PM ERR Unable to connect to api server error="The gcp auth plugin has been removed.\\nPlease use the \\"gke-gcloud-auth-plugin\\" kubectl/client-go credential plugin instead.\\nSee https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke for further details"\n9:08PM ERR ClusterUpdater failed error="Conn check failed (4/5)"\n9:08PM ERR Unable to connect to api server error="The gcp auth plugin has been removed.\\nPlease use the \\"gke-gcloud-auth-plugin\\" kubectl/client-go credential plugin instead.\\nSee https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke for further details"\n9:08PM ERR Conn check failed (5/5). Bailing out!\n
Run Code Online (Sandbox Code Playgroud)\n

我意识到这是因为我的 kubectl 客户端最近更新了,因此 k9s 停止连接到 k8s。

\n

请点击该链接,因为在较新的 kubectl 版本中,gke 的 kubectl 身份验证发生了一些变化。

\n

https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke

\n

再次对我的集群进行了验证

\n
gcloud container clusters get-credentials $CLUSTER_NAME --region $REGION_NAME --project $PROJECT_NAME\n
Run Code Online (Sandbox Code Playgroud)\n

它又起作用了。

\n