Question

Difficulty: EasyManaging Cloud Run Resources

An operations team needs to test a new container image for an existing Cloud Run service named `order-service`. They want to deploy the new revision without automatically directing live user traffic to it, and then split incoming requests so that 10% goes to the new revision while 90% remains on the previous revision (`order-service-00001`). Which TWO gcloud CLI commands should they execute to accomplish this? (Select TWO answers.)

  1. Execute `gcloud run deploy order-service --image=gcr.io/my-project/order-service:v2 --no-traffic` to create the new revision without sending traffic to it.Answer
  2. Execute `gcloud run services update-traffic order-service --to-revisions=order-service-00001=90,order-service-00002=10` to divide incoming traffic between the two revisions.Answer
  3. C
    Execute `gcloud run services update-traffic order-service --to-latest=100` to route traffic to the newly created revision.
  4. D
    Execute `gcloud functions deploy order-service --trigger-http --traffic-split=10` to deploy and adjust traffic allocation.

Answer

The team should execute `gcloud run deploy order-service --image=gcr.io/my-project/order-service:v2 --no-traffic` to create the new revision safely without routing traffic, followed by `gcloud run services update-traffic order-service --to-revisions=order-service-00001=90,order-service-00002=10` to set the 90/10 traffic allocation.
Deploying with `--no-traffic` creates the revision in isolation without routing incoming user requests to it. Following up with `gcloud run services update-traffic` using `--to-revisions` allows administrators to explicitly define percentage traffic distribution across revisions.

Step-by-Step Solution

1
Deploy the updated container image to Cloud Run using the `--no-traffic` flag.
A new Cloud Run revision (`order-service-00002`) is created while 100% of live traffic remains on the previous revision.
By default, `gcloud run deploy` routes 100% of traffic to the newly deployed revision unless `--no-traffic` is specified.
2
Execute `gcloud run services update-traffic` with the `--to-revisions` parameter specifying percentage splits for each target revision.
Incoming traffic is partitioned according to the requested percentages (90% to revision 00001 and 10% to revision 00002).
Traffic splitting between specific revisions requires explicit target revision identifiers and percentage values.

Key Concept

Cloud Run revision deployment and gradual traffic splitting management using gcloud CLI.
Rate this question