为什么我最新的 cloudrun 修订版没有收到流量?

Why doesn't my newest cloudrun revision receive traffic?

我正在尝试在 CloudRun(完全托管)上​​部署 Python (Gunicorn) 应用程序。 大多数情况下,最新部署的修订版在我 运行 部署命令后直接接收 100% 的流量。 然而,有时,部署命令说最新版本收到 0% 的流量(当我尝试访问应用程序时,我确实被重定向到旧版本)。

gcloud beta run deploy my-app \
  --platform=managed \
  --allow-unauthenticated \
  --project my-project \
  --region europe-west1 \
  --port=80 \
  --memory=1Gi \
  --service-account my-app@my-project.iam.gserviceaccount.com \
  --min-instances=1 \
  --image=europe-west1-docker.pkg.dev/my-project/my-registry/my-app:latest

Deploying container to Cloud Run service [my-app] in project [my-project] region [europe-west1]
Service [my-app] revision [my-app-00044-zay] has been deployed and is serving 0 percent of traffic.

为什么我的修订没有收到流量?

假设您之前使用过 --no-traffic,这是按预期工作的,因为此选项是持久的。 尝试 运行 gcloud run services update-traffic --to-latest

参考文档:https://cloud.google.com/sdk/gcloud/reference/run/deploy#--no-traffic