I am struggling to enable deploying to cloud run for a service account. My logic looks something like:
gcloud auth activate-service-account \
[email protected] \
--key-file=my-project-123123213.json
gcloud run deploy my-project-action \
--image "gcr.io/my-project/my-project-action:dev" \
--project my-project \
--verbosity debug \
--region us-central1 \
--allow-unauthenticated \
--platform managed
This fails with:
HttpForbiddenError: HttpError accessing <https://us-central1-run.googleapis.com/apis/serving.knative.dev/v1/namespaces/my-project/services/my-project-action?alt=json>: response: <{'status': '403', 'content-length': '126', 'x-xss-protection': '0', 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'vary': 'Origin, X-Origin, Referer', 'server': 'ESF', '-content-encoding': 'gzip', 'cache-control': 'private', 'date': 'Wed, 01 Jan 2020 23:08:29 GMT', 'x-frame-options': 'SAMEORIGIN', 'alt-svc': 'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000', 'content-type': 'application/json; charset=UTF-8'}>, content <{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
>
ERROR: (gcloud.run.deploy) PERMISSION_DENIED: The caller does not have permission
I have followed the steps https://cloud.google.com/run/docs/reference/iam/roles#additional-configuration for my service account. eg. it has project level roles/run.admin
and roles/iam.serviceAccountUser
. I have also tried giving it roles/editor
or roles/owner
for the project, but same result. I can see on my [email protected]
user that [email protected]
is a service account user.
I can deploy with the same deploy command if I authenticate as myself with gcloud auth login
.
Using [email protected]
and the same auth method, I am able to push new docker images to the container registry, so I think the auth process works, but I am missing some permission or something for cloud run deploy.
BTW I am deploying from cloud-sdk
docker image.
[email protected]
– John Hanleygcloud run services list
for example. – guillaume blaquiere