Question

Difficulty: MediumManaging Cloud Run Resources

A cloud administrator recently deployed a new revision named `orders-v2` for an existing Cloud Run service named `order-processor` in the `us-central1` region. During testing, the administrator specified the `--no-traffic` flag, so 100% of production traffic is still being served by the previous revision `orders-v1`. After verifying that `orders-v2` functions correctly, the administrator needs to immediately route all incoming production traffic to `orders-v2`. Which `gcloud` command should the administrator execute to achieve this target configuration?

  1. gcloud run services update-traffic order-processor --region=us-central1 --to-revisions=orders-v2=100Answer
  2. B
    gcloud run services update order-processor --region=us-central1 --image=gcr.io/my-project/orders:v2
  3. C
    gcloud functions deploy order-processor --region=us-central1 --update-traffic=orders-v2=100
  4. D
    gcloud iam service-accounts add-iam-policy-binding [email protected] --role=roles/owner

Answer

Execute `gcloud run services update-traffic order-processor --region=us-central1 --to-revisions=orders-v2=100` to direct all live traffic to the specified revision.
The command using `gcloud run services update-traffic` with the `--to-revisions=orders-v2=100` flag explicitly adjusts the traffic management configuration of the target Cloud Run service so that 100% of incoming production requests are routed to the specified revision.

Step-by-Step Solution

1
Identify the goal
Shift 100% of live HTTP traffic from revision `orders-v1` to the newly verified revision `orders-v2` for Cloud Run service `order-processor`.
The revision was originally deployed with `--no-traffic` for testing purposes.
2
Select the correct gcloud command group
Use `gcloud run services update-traffic`.
Traffic management operations on existing revisions require the `update-traffic` subcommand.
3
Apply the appropriate flags
Specify `--region=us-central1` and `--to-revisions=orders-v2=100`.
The `--to-revisions` flag maps revision names to integer percentage values.

Key Concept

Cloud Run Traffic Management
Rate this question