Google Associate Cloud Engineer Question 218
Select 2Google Cloud PlatformYou are managing a Cloud Run service called 'web-app' in a Google Cloud Platform project. You need to deploy a new version of the application while ensuring that you can gradually shift traffic from the current version to the new version for testing purposes. Which steps should you take to achieve this?
- A
Deploy the new version using the gcloud command with the --no-traffic flag.
- B
Deploy the new version using the gcloud command with the --set-env-vars flag to specify the environment variables.
- C
Use the Google Cloud Console to manually split traffic between the old and new versions.
- D
Deploy the new version and use Cloud Load Balancing to manage traffic distribution.
Show answer and explanation
Correct answers: A, C
Explanation
To deploy a new version of a Cloud Run service and control traffic distribution for testing, you should first deploy the new version without routing traffic using the --no-traffic flag. This ensures that no traffic is automatically directed to the new deployment. You can then use the Google Cloud Console to manually adjust the traffic split between the old and new versions, allowing you to test the new version under controlled conditions.
- A. Correct.
Deploying with the --no-traffic flag allows you to release a new version without routing traffic to it immediately, enabling manual traffic management later.
- B. Incorrect.
The --set-env-vars flag is used to set environment variables during deployment, but it does not control traffic distribution.
- C. Correct.
Using the Google Cloud Console to manually split traffic allows you to gradually shift traffic between versions, which is essential for testing.
- D. Incorrect.
Cloud Run manages traffic splitting natively, so using Cloud Load Balancing is unnecessary for this purpose.