google-cloud-platform - 无法连接到Google Container Engine

标签 google-cloud-platform google-kubernetes-engine

我已经把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/

相关文章:

node.js - 如何更新 Google Cloud Platform 旧版 GAE 和 GCF 元数据服务器端点

python - 使用 Python 的 GCP 数据流。 "AttributeError: Can' t 获取模块 '_JsonSink' 上的属性 'dataflow_worker.start'

node.js - 用于检索 GCP Node J 中的多个值的数据存储查询

kubernetes - GKE 使用 gcePersistentDisk

kubernetes - 您可以使用 k8s Ingress 将 HTTP 重定向到 HTTPS 吗?

kubernetes - 如何将 Pod 移动到新的节点池/实例组

kubernetes - 如何在我的开发环境上访问kubernetes pod?

kubernetes - 在 Google Kubernetes Engine 中设置 kubernetes 审核策略

google-cloud-platform - 如何构建 Google Cloud dataproc 边缘节点?

google-cloud-storage - 是否可以向服务器授予对 Google Cloud Storage 存储桶的读/写权限,但不能授予删除权限?