Question

Difficulty: MediumManaging Cloud Run Resources

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, 10%10\% of live application traffic must be directed to `payment-gateway-v2` while retaining the remaining 90%90\% on the existing revision. Which sequence of `gcloud` CLI commands should the administrator execute to achieve this?

  1. 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`.Answer
  2. B
    Run `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`.
  3. C
    Run `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`.
  4. D
    Run `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 10%10\% traffic.

Answer

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 10%10\% of traffic to the new revision while preserving the rest on the current active deployment.

Step-by-Step Solution

1
Deploy the new revision using the `--no-traffic` flag
The revision `payment-gateway-v2` is created and available via a unique URL, receiving 0%0\% of production service traffic.
Prevents live user traffic from hitting the unvalidated revision immediately upon deployment.
2
Perform internal testing on the revision-specific URL
Validation of the revision is completed in isolation.
Ensures the application operates correctly in the target runtime environment.
3
Update traffic distribution using `gcloud run services update-traffic`
The revision receives exactly 10%10\% of live traffic, and the remaining 90%90\% stays on the previous active revision.
Safely executes a canary rollout according to the operational requirements.

Key Concept

Managing Cloud Run revision traffic distribution using gcloud CLI traffic flags
Rate this question