9

尝试将映像部署到云运行时出现权限错误:

gcloud beta run deploy endpoints_proxy \
    --image="gcr.io/endpoints-release/endpoints-runtime-serverless:1.30.0" \
    --allow-unauthenticated

这是错误:

ERROR: (gcloud.beta.run.deploy) User [email-goes-here] does not have permission to access namespace [project-id-goes-here] (or it may not exist): Cloud Run does not have permission to get access tokens for the default compute service account, 1088973916567-compute@developer.gserviceaccount.com. Please give Google Cloud Run Service Agent the permission iam.serviceAccounts.getAccessToken on the default compute service account.

我的帐户拥有所有者和编辑者权限,我什至尝试附加 Cloud Run 服务代理角色。

我还尝试将这些角色添加到错误中列出的“默认计算服务帐户”中,但不起作用。

4

2 回答 2

19

该错误消息非常具有误导性,该错误是因为缺少Cloud Run 服务代理而发生的。

创建以下服务帐户后:

Name: service-<account-id>@serverless-robot-prod.iam.gserviceaccount.com
Role: Google Cloud Run Service Agent

问题得到了解决。看起来 Cloud Run 需要此服务帐号才能正常工作,所以永远不要删除它 :)

于 2019-05-09T23:36:26.137 回答
3

您应该启用对 Cloud Build 服务帐号的权限。除非你这样做,否则它不会起作用。

Google Cloud Console > Cloud Build > Cloud Build Settings > 启用对您正在使用的 GCP 服务的访问。(见附图)

云构建面板

Cloud Build Panel - 启用您想要的服务

于 2021-05-18T23:36:11.730 回答