无法连接到Google Container Engine [英] Unable to connect to Google Container Engine
问题描述
我已将gcloud更新为最新版本(159.0.0)
I've updated gcloud to the latest version (159.0.0)
我创建了一个Google Container Engine节点,然后按照提示中的说明进行操作.
I created a Google Container Engine node, and then followed the instructions in the prompt.
gcloud container clusters get-credentials prod --zone us-west1-b --project myproject
Fetching cluster endpoint and auth data.
kubeconfig entry generated for prod
kubectl proxy
Unable to connect to the server: error executing access token command
"/Users/me/Code/google-cloud-sdk/bin/gcloud ": exit status
有人知道为什么它无法连接吗?
Any idea why is it not able to connect?
推荐答案
看来,GKE的默认auth插件在Windows上可能有问题. kubectl尝试运行gcloud以获得令牌以对您的集群进行身份验证.如果运行kubectl config view
,则可以看到它尝试运行的命令,然后自己运行以查看是否/为什么失败.
It looks like the default auth plugin for GKE might be buggy on windows. kubectl is trying to run gcloud to get a token to authenticate to your cluster. If you run kubectl config view
you can see the command it tried to run, and run it yourself to see if/why it fails.
正如Alexandru所说,一种解决方法是使用Google Application Default Credentials.实际上,gcloud容器内置了对此功能的支持,您可以通过设置属性进行切换:
As Alexandru said, a workaround is to use Google Application Default Credentials. Actually, gcloud container has built in support for doing this, which you can toggle by setting a property:
gcloud config set container/use_application_default_credentials true
或设置环境变量
%CLOUDSDK_CONTAINER_USE_APPLICATION_DEFAULT_CREDENTIALS%
到true
.
这篇关于无法连接到Google Container Engine的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!