A cloud administrator needs to release a containerized application update to a Cloud Run service named `payment-gateway` running in `us-central1`. To perform a canary release, the new container revision `payment-gateway-v2` must first be deployed without receiving any production traffic so that internal testing can occur. Once validated, of live application traffic must be directed to `payment-gateway-v2` while retaining the remaining on the existing revision. Which sequence of `gcloud` CLI commands should the administrator execute to achieve this?
- Run `gcloud run deploy payment-gateway --image gcr.io/my-project/payment-gateway:v2 --no-traffic --region us-central1`, test the revision, and then run `gcloud run services update-traffic payment-gateway --to-revisions payment-gateway-v2=10 --region us-central1`.Cevap
- BRun `gcloud run deploy payment-gateway --image gcr.io/my-project/payment-gateway:v2 --region us-central1`, test the revision, and then run `gcloud run services update-traffic payment-gateway --to-revisions payment-gateway-v2=10 --region us-central1`.
- CRun `gcloud functions deploy payment-gateway --image gcr.io/my-project/payment-gateway:v2 --no-traffic --region us-central1`, test the revision, and then run `gcloud functions event-providers update payment-gateway --traffic-split payment-gateway-v2=10 --region us-central1`.
- DRun `gcloud run deploy payment-gateway --image gcr.io/my-project/payment-gateway:v2 --no-traffic --region us-central1`, and grant the primitive `roles/owner` role to the service identity to automatically split traffic.
Cevap
Deploy the new revision using `gcloud run deploy payment-gateway --image gcr.io/my-project/payment-gateway:v2 --no-traffic --region us-central1`, validate the deployment, and then execute `gcloud run services update-traffic payment-gateway --to-revisions payment-gateway-v2=10 --region us-central1`.
The correct approach deploys the new container image to Cloud Run using `--no-traffic`, ensuring no live production traffic hits the revision until testing completes. Executing `gcloud run services update-traffic` with `--to-revisions payment-gateway-v2=10` explicitly shifts of traffic to the new revision while preserving the rest on the current active deployment.
Adım Adım Çözüm
Anahtar Kavram
Managing Cloud Run revision traffic distribution using gcloud CLI traffic flags