mar*_*doi 1 google-cloud-platform google-cloud-run
我使用 GCP Cloud Build 和以下命令部署了两个 Cloud Run 服务(暂存和生产):
entrypoint: gcloud
args: ['run', 'deploy', 'app', '--project', '$PROJECT_ID', '--image', 'image:$COMMIT_SHA', '--region', 'us-central1', '--allow-unauthenticated', '--memory' , '256Mi', '--update-env-vars', 'ENV=production']
Run Code Online (Sandbox Code Playgroud)
我注意到相同的命令在暂存和生产中具有不同的行为。在我的一项服务上,流量不会自动路由到最新版本。
Already have image (with digest):
Deploying container to Cloud Run service
Deploying...
Setting IAM Policy..............done
Creating Revision..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................done
Done.
Service [] revision [] has been deployed and is serving 0 percent of traffic.
I am missing this step :
Routing traffic......done
Run Code Online (Sandbox Code Playgroud)
我检查了云运行service.yaml并设置了流量参数:
traffic:
- latestRevision: true
percent: 100
Run Code Online (Sandbox Code Playgroud)
如果我在 GCP 控制台上运行相同的命令,一切都会按预期运行。
问题:gcloud run deploy当我从 Cloud Build 管道运行时,为什么不路由流量?(我没有--no traffic设置标志)
它似乎与这个问题有关:https ://issuetracker.google.com/issues/172165141
您可以使用两种模式:将流量路由到最新版本或手动分发。如果您切换到手动路由,服务将保持这样,直到您决定使用 恢复它gcloud run services update-traffic testservice --platform="managed" --to-latest.。这样做是为了保持简单并消除歧义和意外的流量切换。
| 归档时间: |
|
| 查看次数: |
3673 次 |
| 最近记录: |