Soru

Zorluk: ZorDeploying Serverless Applications with Cloud Run and Cloud Functions

A DevOps engineer is deploying an updated version of a microservice named order-processor to Google Cloud Run. The team requires deploying the container image gcr.io/acme-ship/order-proc:v2 to create a new revision without directing any production traffic to it upon deployment. Furthermore, the new revision must be directly testable via a dedicated revision URL tag named canary while 100% of live traffic remains on the existing stable revision. Which gcloud command should the engineer execute to fulfill these requirements?

  1. gcloud run deploy order-processor --image=gcr.io/acme-ship/order-proc:v2 --no-traffic --tag=canaryCevap
  2. B
    gcloud run deploy order-processor --image=gcr.io/acme-ship/order-proc:v2 --traffic=canary=100
  3. C
    gcloud functions deploy order-processor --image=gcr.io/acme-ship/order-proc:v2 --no-traffic --tag=canary
  4. D
    gcloud run deploy order-processor --image=gcr.io/acme-ship/order-proc:v2 --no-traffic --role=roles/owner

Cevap

Execute gcloud run deploy order-processor --image=gcr.io/acme-ship/order-proc:v2 --no-traffic --tag=canary
The correct command combines --no-traffic and --tag=canary during gcloud run deploy. The --no-traffic flag creates the new revision without routing any production traffic to it, keeping existing traffic on the current revision. The --tag flag creates a unique URL prefix (canary) pointing directly to the new revision so engineers can test it in isolation.

Adım Adım Çözüm

1
Identify the service deployment mechanism and container source
Use gcloud run deploy with the specified container image gcr.io/acme-ship/order-proc:v2.
Cloud Run manages containerized web workloads and supports revision tagging.
2
Configure traffic suppression flags
Include the --no-traffic flag in the deployment command.
This prevents Cloud Run from automatically routing production traffic to the new revision.
3
Assign the testing URL tag
Include the --tag=canary flag.
This generates a tagged endpoint URL (e.g., canary---order-processor-xyz.a.run.app) for targeted testing before shifting production traffic.

Anahtar Kavram

Cloud Run Traffic Management and Revision Tagging
Bu soruyu puanla