Soru

Zorluk: ZorManaging Cloud Run Resources

A DevOps engineer manages a production Cloud Run service named `billing-service` deployed in the `us-central1` region. To test a performance optimization patch in production with minimal risk, the engineer deployed a new revision named `billing-service-00002-patch` using the `--no-traffic` flag. Currently, 100%100\% of production traffic continues to be routed to the baseline revision `billing-service-00001-base`. The engineer must now configure the service to route 15%15\% of incoming traffic to `billing-service-00002-patch` while leaving the remaining 85%85\% on `billing-service-00001-base`.

Which `gcloud` command should the engineer execute to implement this precise traffic split?

  1. gcloud run services update-traffic billing-service --region us-central1 --to-revisions billing-service-00002-patch=15,billing-service-00001-base=85Cevap
  2. B
    gcloud run deploy billing-service --region us-central1 --image gcr.io/my-project/billing-service:latest --update-traffic
  3. C
    gcloud functions deploy billing-service --region us-central1 --traffic-split billing-service-00002-patch=15
  4. D
    gcloud run services update billing-service --region us-central1 --set-env-vars TRAFFIC_SPLIT=15

Cevap

The command `gcloud run services update-traffic billing-service --region us-central1 --to-revisions billing-service-00002-patch=15,billing-service-00001-base=85` correctly adjusts the traffic allocation between existing Cloud Run revisions.
The correct command utilizes `gcloud run services update-traffic` with the `--to-revisions` flag to explicitly allocate 15%15\% of traffic to `billing-service-00002-patch` and 85%85\% to `billing-service-00001-base`. This adheres directly to GCP Cloud Run traffic management specifications.

Adım Adım Çözüm

1
Identify the target Cloud Run service and region
Service name is `billing-service` and region is `us-central1`.
Cloud Run service management requires specifying the service identifier and regional scope.
2
Determine the CLI command sub-group for traffic routing
Use `gcloud run services update-traffic`.
Traffic allocations across revisions are managed via the `update-traffic` command sub-group rather than standard image deployments or environment variable updates.
3
Specify explicit revision traffic percentages
Pass `--to-revisions billing-service-00002-patch=15,billing-service-00001-base=85`.
The `--to-revisions` flag takes a comma-separated key-value list mapping revision names to integer percentages summing to 100%100\%.

Anahtar Kavram

Cloud Run Revision Traffic Splitting
Tahmini Süre:2m 0s
Bu soruyu puanla