简体   繁体   中英

`gcloud run deploy` raises "Revision <revision_name> is not ready and cannot serve traffic."

Command

gcloud run deploy api --region=$REGION --image=$IMAGE

Logs

Deploying container to Cloud Run service [api] in project [[MASKED]] region [[MASKED]]
Deploying...
Creating Revision...........interrupted
Deployment failed
ERROR: (gcloud.run.deploy) Revision [[MASKED]] is not ready and cannot serve traffic.

I've tried to search Google Cloud documentation, but it does not mention such problem.

How to solve the "Revision is not ready and cannot serve traffic."?

Try to wait a few minutes and then just re-launch the procedure. The good old "let's retry without changing anything" worked for me! :)

EDIT: I talked with a solution architect who works with me and he told me that this is the actual solution, because if you retry too quickly to restart the deploy, GCP may still have some pending operations from the previous one!

I faced the same error in Cloud Run after getting the container working correctly locally. In my case the revisions weren't showing as failing, they had a grey checkmark

复选标记

and when hovering I got the message

The revision is healthy but not currently serving traffic.

I just needed to click Manage Traffic and set 100% of the traffic to a new revision

I faced this problem as well. In my case I checked "Cloud Run" section from hamburger menu of google cloud console . The "Logs" section should give you more idea about what went wrong. I was missing a python library, and adding correct python dependency in my requirements.txt solved the issue for me. Somehow my local testing went well without this issue. I hope this helps. :)

I faced with this problem, my problem is that my docker image is missing required dependency package at build stage, my Dockerfile missed some steps to copy required files for preparing to install package.

To find you problem if cloud build logs was not make sense for you, I think you should:

  • From gcloud console , go to service "Container Registry" > Images
  • Select your repository name
  • From the image version (maybe latest) that you want to check > more actions > show pull command > then copy that command ex: docker pull gcr.io/..
  • From gcloud console header > select activate cloud shell
  • At cloud shell terminal, pull docker images of your latest build by running "pull command" that you copied before.
  • Start your container from this image to see what exactly happens with your run revision

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM