[英]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.