Associate Cloud Engineer ยท Cloud Run operations and accelerators
Cloud Run revisions and traffic splitting
New revisions on deploy, --no-traffic and tags, gradual rollout with update-traffic, rollback; traffic splitting concepts for Cloud Run functions and GKE.
Key points
- Every deploy creates a new immutable revision.
- By default it gets 100% of traffic.
- Use --no-traffic to deploy without serving it, --tag to give it a test URL, and gcloud run services update-traffic (--to-revisions, --to-tags, --to-latest) to shift traffic gradually or roll back by sending 100% to an older revision.
Source: https://docs.cloud.google.com/run/docs/rollouts-rollbacks-traffic-migration
Practice questions
Which gcloud run deploy flag creates a new revision without sending it any traffic?
- --tag
- --no-traffic
- --to-latest
- --async
Show answer
Answer: B. --no-traffic
--no-traffic deploys the revision but leaves existing traffic assignments alone. --tag only names a revision, --to-latest moves traffic, and --async only affects waiting.
Which actions send 100% of traffic back to a known-good revision named shop-v1?
- gcloud run services update-traffic shop --to-revisions=shop-v1=100
- gcloud run deploy shop --image IMAGE --no-traffic
- gcloud run services update-traffic shop --to-tags=stable=100, where tag stable points at shop-v1
- gcloud run services update-traffic shop --remove-tags=canary
- gcloud run services update shop --min-instances=0
Show answer
Answer: A. gcloud run services update-traffic shop --to-revisions=shop-v1=100, C. gcloud run services update-traffic shop --to-tags=stable=100, where tag stable points at shop-v1
Rollback is update-traffic with the revision at 100, either by name or through a tag that points at it. Deploying with --no-traffic serves nothing new, changing a tag alone never moves traffic, and min-instances does not route traffic.
True or false: adding a tag to a revision automatically sends it a share of traffic.
Show answer
Answer: False
False. Tags give a revision a dedicated URL and a handle for update-traffic, but they do not change traffic percentages on their own.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
