简体   繁体   English

kubectl访问Google Cloud Container Engine失败

[英]kubectl access to Google Cloud Container Engine fails

In Google Cloud Platform I have a Container-Cluster with three running instances. 在Google Cloud Platform中,我有一个包含三个正在运行的实例的Container-Cluster。 I now want to connect from my terminal to be able to run kubectl commands. 我现在想从我的终端连接,以便能够运行kubectl命令。 For this I ran the command 为此,我运行了命令

gcloud container clusters get-credentials cluster-1 --zone europe-west1-b --project project-id

I am using the real project name of course. 我当然使用真正的项目名称。 This is the command shown by the dashboard when clicking on 'connect with the cluster'. 这是点击“与群集连接”时仪表板显示的命令。 The output of this command is: 该命令的输出是:

Fetching cluster endpoint and auth data.
kubeconfig entry generated for cluster-1.

But when I run kubectl commands afterwards like kubectl cluster-info I always get: 但是当我像kubectl cluster-info之后运行kubectl命令时,我总是得到:

Unable to connect to the server: oauth2: cannot fetch token: 400 Bad Request
Response: {
  "error" : "invalid_grant",
  "error_description" : "Token has been revoked."
}

What am I missing here? 我在这里错过了什么? gcloud commands like gcloud container clusters list work gcloud container clusters list工作的gcloud命令

I tried from a different machine at home, and there it was working after installing and setting up gcloud. 我在家里尝试了另一台机器,在安装和设置gcloud之后它正在工作。 I think that on my work machine there is still an oauth token stored with which I authenticated to a different google account I used for a test. 我认为在我的工作机器上仍然存储了一个oauth令牌,我通过该令牌验证了我用于测试的不同谷歌帐户。

Edit: I got it running now. 编辑:我现在正在运行它。 the problem was that I missed the second of the necessary calls: 问题是我错过了第二个必要的电话:

gcloud auth login
gcloud auth application-default login

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用容器引擎的kubectl oauth2身份验证失败 - kubectl oauth2 authentication with container engine fails kubectl无法连接到Google容器引擎 - kubectl can't connect to Google Container Engine Google云端平台:无法从Container Engine访问Pubsub - Google Cloud Platform: cannot access Pubsub from Container Engine 撤消对谷歌容器引擎上的kubernetes群集的访问权限 - Revoke access to kubernetes cluster on google container engine 如何从Google Container Engine连接Google Cloud SQL? - How to connect Google Cloud SQL from Google Container Engine? 如何使用Google Container Engine与Google Cloud SQL建立连接? - How to make connection with Google Cloud SQL using Google Container Engine? 如何在Google Cloud Container Engine上公开展示Traefik入口控制器? - How to publicly expose Traefik ingress controller on Google Cloud Container Engine? Google Cloud容器引擎(GKE)上的IAM和RBAC冲突 - IAM and RBAC Conflicts on Google Cloud Container Engine (GKE) 将代码/文件直接注入 Google Cloud Engine 上 Kubernetes 的容器中 - Inject code/files directly into a container in Kubernetes on Google Cloud Engine 使用Java App从Container Engine连接到Google Cloud SQL - Connect to Google Cloud SQL from Container Engine with Java App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM