A Cloud Operations team is preparing to deploy an update to a mission-critical web application hosted on Google Cloud Run using the gcloud CLI. Company policy requires that newly deployed container revisions must receive zero percent of live customer traffic immediately upon deployment, allowing quality assurance engineers to smoke-test the revision at its dedicated revision URL before shifting production traffic. Which command flag should the team include when executing gcloud run deploy?
- Include the --no-traffic flag during the gcloud run deploy execution.Answer
- BInclude only the --tag flag during deployment without additional flags, assuming tagged revisions automatically route 0% traffic.
- CGrant the primitive Owner role (roles/owner) to the Cloud Run service account before deploying the container image.
- DDeploy the application to Cloud Functions gen 1 instead of Cloud Run to prevent automatic revision traffic shifting.
Answer
The correct option is to specify the `--no-traffic` flag during the `gcloud run deploy` execution.
When deploying a containerized application using `gcloud run deploy`, Cloud Run by default updates the service traffic routing to send 100% of live traffic to the newly created revision. Providing the `--no-traffic` flag creates the revision while keeping all existing traffic routed to previous revisions, satisfying the smoke-testing requirement.
Step-by-Step Solution
Key Concept
Cloud Run Revision Traffic Splitting and Deployment Flags