A DevOps engineer needs to deploy a new revision of an existing containerized API service to Google Cloud Run. To satisfy testing requirements, the new revision must be deployed without receiving any production user traffic until internal verification is complete. Which command should the engineer execute to deploy the container image while preserving 100% of live traffic on the current revision?
- gcloud run deploy api-service --image=gcr.io/my-project/api:v2 --no-trafficAnswer
- Bgcloud run deploy api-service --image=gcr.io/my-project/api:v2 --traffic=0
- Cgcloud run deploy api-service --image=gcr.io/my-project/api:v2 --min-instances=0
- Dgcloud functions deploy api-service --image=gcr.io/my-project/api:v2 --no-traffic
Answer
The command containing `gcloud run deploy api-service --image=gcr.io/my-project/api:v2 --no-traffic` correctly deploys the container revision without directing traffic to it.
Executing `gcloud run deploy` with the `--no-traffic` flag creates the new service revision in Google Cloud Run while retaining 100% of live production traffic on the previously serving revision. This allows developers to safely verify and test the new revision via revision-specific URLs or tags before updating the service traffic split.
Step-by-Step Solution
Key Concept
Cloud Run Traffic Management during Revision Deployment
Estimated Time:1m 30s