Question

Difficulty: MediumManaging Cloud Run Resources

A Cloud Engineer is tasked with performing a canary release for an updated container image on an existing Cloud Run service named `orders-api`. The objective is to deploy the updated revision without exposing it to live production traffic immediately, perform validation on the revision's dedicated URL, gradually shift 10% of production traffic to the new revision, and monitor its operational metrics. Sequence the following deployment and traffic management steps in the correct order from first to last.

  1. 1Execute `gcloud run deploy orders-api --image [IMAGE_URI] --no-traffic` to deploy the new revision without routing production traffic to it.
  2. 2Send test requests to the revision-specific URL (or tagged URL) of the newly created revision to verify functionality.
  3. 3Execute `gcloud run services update-traffic orders-api --to-revisions [NEW_REVISION_NAME]=10` to shift 10% of live traffic to the new revision.
  4. 4Monitor error rates and request latency in Cloud Logging and Cloud Monitoring for the canary revision.

Answer

The correct sequence of steps for a Cloud Run canary deployment is: 1) Deploy the new container image using `gcloud run deploy` with the `--no-traffic` flag, 2) Test the new revision using its direct revision-specific URL, 3) Update the traffic distribution using `gcloud run services update-traffic` to route 10% of traffic to the new revision, and 4) Monitor service logs and metrics in Cloud Operations to verify operational health.
The deployment workflow requires creating the revision safely without live traffic (`--no-traffic`), verifying its health via direct revision URL targeting, applying a 10% canary traffic split with `gcloud run services update-traffic`, and finally inspecting metrics in Cloud Operations to ensure baseline operational stability.

Step-by-Step Solution

1
Deploy the updated container image to Cloud Run ensuring live traffic is not impacted.
A new Cloud Run revision is instantiated, but 100% of production traffic continues to serve from the existing revision due to `--no-traffic`.
Deploying with `--no-traffic` prevents unverified code from immediately receiving live production requests.
2
Perform direct revision testing.
The engineer confirms that the revision responds correctly without risking impact on end users.
Cloud Run automatically assigns a unique URL (or tag-based URL) to each revision for targeted testing.
3
Configure traffic splitting via CLI.
10% of inbound service requests are routed to the new revision and 90% to the previous revision.
The command `gcloud run services update-traffic` adjusts traffic percentages across active revisions.
4
Observe performance and error metrics.
Metrics confirm whether the canary revision operates stably under real traffic conditions.
Monitoring latency and HTTP error rates provides empirical proof of success before rolling out 100% of traffic.

Key Concept

Canary Deployments and Traffic Splitting in Cloud Run
Rate this question