Soru

Zorluk: ZorManaging Cloud Run Resources

An organization hosts a backend application on Google Cloud Run. Following a new deployment of revision `orders-v2`, operations personnel observe a sudden spike in HTTP 500 error responses. A cloud engineer must immediately direct 100% of incoming production traffic back to the previous stable revision, `orders-v1`, while preserving `orders-v2` intact for internal diagnostic testing. Which `gcloud` command should the engineer execute to achieve this objective?

  1. gcloud run services update-traffic orders-service --to-revisions=orders-v1=100Cevap
  2. B
    gcloud run deploy orders-service --image=gcr.io/my-project/orders:v1 --no-traffic
  3. C
    gcloud functions deploy orders-service --source=orders-v1 --trigger-http
  4. D
    gcloud projects add-iam-policy-binding my-project --member=allUsers --role=roles/editor

Cevap

The command `gcloud run services update-traffic orders-service --to-revisions=orders-v1=100` correctly shifts 100% of incoming service traffic to revision `orders-v1`.
Executing `gcloud run services update-traffic orders-service --to-revisions=orders-v1=100` updates the service traffic assignment so that 100% of live HTTP traffic goes to the previous stable revision `orders-v1`. Revision `orders-v2` remains deployed in the background, allowing developers to inspect its logs or send direct test queries to its revision-specific URL.

Adım Adım Çözüm

1
Identify the requirement to modify traffic weights across active revisions of a Cloud Run service.
Determine that revision `orders-v2` is producing errors and traffic must revert to `orders-v1`.
Traffic management on existing revisions is handled via the `gcloud run services update-traffic` command.
2
Apply the `--to-revisions` flag specifying the targeted target revision and percentage.
Execute `gcloud run services update-traffic orders-service --to-revisions=orders-v1=100`.
This immediately redirects all live production requests to `orders-v1` without deleting or modifying `orders-v2`.

Anahtar Kavram

Managing Cloud Run Revision Traffic Splitting
Bu soruyu puanla