google-cloud-platform - 403 "Request had insufficient authentication scopes"在 gcloud 容器集群获取凭据期间

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

从 GCE 中的虚拟机中,我执行了以下操作

gcloud auth activate-service-account --key-file <blah>
# "blah" is a service account key file (JSON) I generated from the web interface
gcloud config set project <project-name>
gcloud config set compute/zone <zone-name>
gcloud set container/cluster <cluster-name>

然后当我尝试运行

gcloud container clusters get-credentials <cluster-name>

失败并显示错误消息:

Error message: "ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=403, message=Request had insufficient authentication scopes."

虚拟机与 GKE 集群位于同一网络。我尝试了同样的操作,使用来自 GCE 外部计算机的相同服务帐户 key 文件,针对“默认”网络上的 GKE 集群,并且成功了...

最佳答案

要从 GCE 虚拟机使用 Google Kubernetes Engine API,您需要在创建虚拟机时将云平台范围(“https://www.googleapis.com/auth/cloud-platform ”)添加到虚拟机中。

关于google-cloud-platform - 403 "Request had insufficient authentication scopes"在 gcloud 容器集群获取凭据期间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35928534/

相关文章:

Kubernetes 入口(hostNetwork=true),无法通过节点 IP 访问服务 - GCP

android - 卸载应用程序后谷歌游戏服务数据消失

google-apps-script - G Suite 市场 : At least one extension must be enabled and selected extensions must be configured

docker - 在 Ubuntu 20.04 上从 GCE vm 中的 GCR 拉取

elasticsearch - 为什么 Kubernetes 1.16 上的 elasticsearch-master-headless 搜索名称解析失败?

elasticsearch - SSH 进入 GKE 私有(private)集群节点

python - 在 CLIPPER.AI 中连接到 kubernetes 时出错

json - 如何在 BigQuery 的 ARRAY 中添加 null

hadoop - 向 dataproc sqoop 提交作业时出现问题

kubernetes - GKE 删除部署不会删除副本集