在 GCE VM 实例上执行 "gcloud container clusters create" 所需的范围

Scopes required for executing "gcloud container clusters create" on GCE VM instance

我正在尝试通过在 GCE VM 实例上执行以下命令来创建 GKE 集群:

sudo gcloud container clusters create my-cluster \
  --machine-type g1-small --num-nodes 1

执行失败并显示此错误消息(尽管已安装 kubectl):

WARNING: Accessing a Container Engine cluster requires the kubernetes commandline client [kubectl].
ERROR: (gcloud.container.clusters.create) ResponseError: code=403, message=Request had insufficient authentication scopes.

这个问题可能是由于虚拟机实例没有足够的范围造成的。目前拥有以下几家。为了使问题消失,还需要哪些其他范围?

Google Container Engine 需要 https://www.googleapis.com/auth/cloud-platform 范围,因此您在创建 VM 实例时需要 select "Allow full access to all Cloud APIs"。