Google Compute Engine:需要“compute.machineTypes.get”权限

问题描述

我正在尝试在 GCP 中创建 kubernetes 集群,但我无法创建并收到以下错误“Google Compute Engine:‘projects/PROJECT_ID/zones/us-central1-a/’所需的‘compute.machineTypes.get’权限machineTypes/e2-medium'"。 并且还得到如下区域错误 “Google 计算引擎:‘projects/PROJECT_ID/zones/us-central1-a’需要‘compute.zones.get’权限”。

解决方法

从错误中我了解到这是权限问题。

为了创建 kubernetes 集群 create a service 帐户并为其分配编辑器角色。现在,activate the service account 在 gcloud shell 中。使用以下命令 create a cluster

gcloud container clusters create sample-cluster

如果问题仍然存在,您需要为服务帐户授予以下权限。

roles/compute.instanceAdmin
roles/iam.serviceAccountUser
,

是的,这是一个权限问题。我在 IAM 中为我的用户添加了“Kubernetes 引擎管理员”角色,然后我来解决我在 GCP 中创建 kubernetes 集群的问题,感谢您的建议。