Soru

Zorluk: OrtaManaging Cloud Run Resources

An organization manages a critical microservice deployed on Cloud Run named `payment-processor` in the `us-central1` region. Following the deployment of a new revision named `payment-processor-00005-xyz`, Cloud Monitoring metrics reveal a sharp increase in HTTP 500 error rates. The operations team needs to immediately redirect 100% of live incoming production traffic back to the previous stable revision named `payment-processor-00004-abc` without deleting the failed revision so developers can inspect its logs. Which `gcloud` CLI command should the operations team run to execute this rollback?

  1. gcloud run services update-traffic payment-processor --to-revisions=payment-processor-00004-abc=100 --region=us-central1Cevap
  2. B
    gcloud run services update payment-processor --to-revision=payment-processor-00004-abc --region=us-central1
  3. C
    gcloud functions deploy payment-processor --source-revision=payment-processor-00004-abc --region=us-central1
  4. D
    gcloud run revisions delete payment-processor-00005-xyz --region=us-central1

Cevap

Execute `gcloud run services update-traffic payment-processor --to-revisions=payment-processor-00004-abc=100 --region=us-central1` to immediately route all production traffic back to the stable revision.
The command `gcloud run services update-traffic payment-processor --to-revisions=payment-processor-00004-abc=100 --region=us-central1` correctly routes 100% of live traffic to the specified healthy revision while leaving the faulty revision intact for troubleshooting.

Adım Adım Çözüm

1
Identify the target revision to receive traffic and the required percentage.
The target revision is `payment-processor-00004-abc` and needs 100% of production traffic.
Emergency rollbacks require directing full live traffic away from the erroneous revision instantly.
2
Select the proper gcloud CLI tool for Cloud Run traffic routing.
Use `gcloud run services update-traffic`.
`update-traffic` explicitly adjusts routing weights between revisions.
3
Specify the revision mapping flag `--to-revisions` along with region metadata.
Construct `gcloud run services update-traffic payment-processor --to-revisions=payment-processor-00004-abc=100 --region=us-central1`.
This guarantees that revision `payment-processor-00005-xyz` receives 0% of traffic while preserving its instance data and logs.

Anahtar Kavram

Cloud Run Traffic Management and Revision Rollbacks
Bu soruyu puanla