在创建资源之前启用 API 时,我们遇到了一个服务帐户“默认”到创建它的项目的问题。
SA 是在项目 A 下创建的,但它拥有Owner
项目 B 的权限。
我们正在尝试在项目 B中创建一个资源(GKE 集群),但它抱怨我们需要首先在项目 A上启用 Kubernetes API (我们正在传递--project
给集群创建命令以避免在我们尝试创建的位置出现任何歧义集群。get-credentials 命令也是如此)。
ERROR: (gcloud.container.clusters.create) ResponseError: code=403, message=Kubernetes Engine API has not been used in project PROJECT_NUMBER before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/container.googleapis.com/overview?project=PROJECT_NUMBER then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
PROJECT_NUMBER
这里是项目 A 的数量,而不是 B。所需的 API 已经在项目 B 上启用。
我们在这里使用服务帐户的方法是否存在缺陷?