Soru

Zorluk: ZorManaging Cloud Run Resources

A cloud engineer manages a production Cloud Run service named `checkout-api` deployed in the `europe-west1` region. A new revision named `checkout-api-v2` was previously deployed with the `--no-traffic` flag for testing. After successful verification, the engineer must immediately adjust the live traffic allocation so that 25%25\% of incoming requests are routed to `checkout-api-v2` while the remaining 75%75\% continues to serve on the existing revision `checkout-api-v1`. Which `gcloud` command should the engineer run to accomplish this traffic split?

  1. gcloud run services update-traffic checkout-api --region=europe-west1 --to-revisions=checkout-api-v1=75,checkout-api-v2=25Cevap
  2. B
    gcloud run deploy checkout-api --region=europe-west1 --image=gcr.io/my-project/checkout-api:v2 --traffic=checkout-api-v1=75,checkout-api-v2=25
  3. C
    gcloud functions deploy checkout-api --region=europe-west1 --update-traffic=checkout-api-v1=75,checkout-api-v2=25
  4. D
    gcloud run services update-traffic checkout-api --region=europe-west1 --to-latest

Cevap

The command `gcloud run services update-traffic checkout-api --region=europe-west1 --to-revisions=checkout-api-v1=75,checkout-api-v2=25` correctly splits traffic between existing Cloud Run revisions.
To modify traffic distribution across existing Cloud Run revisions without creating a new revision, you must use the `gcloud run services update-traffic` command. Specifying `--to-revisions=checkout-api-v1=75,checkout-api-v2=25` explicitly routes 75%75\% of incoming requests to the baseline revision and 25%25\% to the test revision.

Adım Adım Çözüm

1
Identify the operational goal for managing existing Cloud Run revisions
Recognize that traffic needs to be split across existing revisions (`checkout-api-v1` and `checkout-api-v2`) without creating a new revision.
Deploying a new container container image is unnecessary since `checkout-api-v2` is already deployed.
2
Select the correct gcloud CLI subcommand for Cloud Run traffic management
Use `gcloud run services update-traffic` rather than `gcloud run deploy` or `gcloud functions deploy`.
The `update-traffic` command specifically manages traffic assignments across active revisions of a service.
3
Configure revision target flags and percentages
Pass `--to-revisions=checkout-api-v1=75,checkout-api-v2=25` along with the `--region=europe-west1` flag.
The `--to-revisions` flag maps explicit revision names to their respective integer traffic percentages.

Anahtar Kavram

Managing Cloud Run revision traffic allocation via gcloud run services update-traffic
Tahmini Süre:2m 0s
Bu soruyu puanla