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 of incoming requests are routed to `checkout-api-v2` while the remaining continues to serve on the existing revision `checkout-api-v1`. Which `gcloud` command should the engineer run to accomplish this traffic split?
- gcloud run services update-traffic checkout-api --region=europe-west1 --to-revisions=checkout-api-v1=75,checkout-api-v2=25Cevap
- Bgcloud run deploy checkout-api --region=europe-west1 --image=gcr.io/my-project/checkout-api:v2 --traffic=checkout-api-v1=75,checkout-api-v2=25
- Cgcloud functions deploy checkout-api --region=europe-west1 --update-traffic=checkout-api-v1=75,checkout-api-v2=25
- Dgcloud 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 of incoming requests to the baseline revision and to the test revision.
Adım Adım Çözüm
Anahtar Kavram
Managing Cloud Run revision traffic allocation via gcloud run services update-traffic
Tahmini Süre:2m 0s