尝试部署到Google Cloud Run时出现权限错误

时间:2019-05-09 23:36:26

标签: google-cloud-platform google-cloud-run

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

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 Service Agent角色。

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

2 个答案:

答案 0 :(得分:2)

该错误消息非常容易引起误解,因为缺少 Cloud Run Service Agent 而发生该错误。

创建以下服务帐户后:

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

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

答案 1 :(得分:0)

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

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

Cloud Build Panel

Cloud Build Panel - enable services that you want

相关问题