我已经把gcloud更新到了最新版本(159.0.0)
我创建了一个Google Container Engine节点,然后按照提示中的说明进行操作。
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
知道为什么它无法连接吗?
最佳答案
您可以尝试运行以查看配置是否正确生成:
kubectl config view
尝试在刚刚在Google Cloud Platform上创建的新Kubernetes集群上运行kubectl命令时,我遇到了类似的问题。
我的案例的解决方案是激活 Google应用程序默认凭据。
您可以在下面找到有关如何激活它的链接。
基本上,您需要使用GCP的凭据将环境变量设置为.json的路径
从Google Cloud导出的
GOOGLE_APPLICATION_CREDENTIALS -> c:\...\..\..Credentials.json
https://developers.google.com/identity/protocols/application-default-credentials我在kuberenetes github问题上找到了此解决方案:https://github.com/kubernetes/kubernetes/issues/30617
附言:请确保您还设置了以下环境变量:
%HOME%至%USERPROFILE%
%KUBECONFIG%至%USERPROFILE%
关于google-cloud-platform - 无法连接到Google Container Engine,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44643444/