Question

Difficulty: MediumManaging Compute Engine Resources

An Associate Cloud Engineer needs to update the container image running on a regional Managed Instance Group (MIG) without incurring downtime. Order the steps required to safely execute a rolling update of the MIG using the Google Cloud CLI.

  1. 1Create a new Compute Engine instance template specifying the updated container image.
  2. 2Update the Managed Instance Group configuration to reference the newly created instance template.
  3. 3Execute `gcloud compute instance-groups managed rolling-action start-update` targeting the Managed Instance Group.
  4. 4Execute `gcloud compute instance-groups managed wait-until --stable` to monitor progress until all instances are healthy.

Answer

The correct operational sequence is: 1) Create a new instance template with the updated container image, 2) Update the Managed Instance Group to target the new instance template, 3) Issue the `gcloud compute instance-groups managed rolling-action start-update` command, and 4) Verify completion using `gcloud compute instance-groups managed wait-until --stable`.
To update a Managed Instance Group without downtime, you must first create a new instance template since templates are immutable. Next, update the MIG target template setting to point to the new version. Then, initiate the rolling update via `gcloud compute instance-groups managed rolling-action start-update`. Finally, execute `gcloud compute instance-groups managed wait-until --stable` to verify that all instances reach a healthy, updated state.

Step-by-Step Solution

1
Create a new Compute Engine instance template with the updated configuration.
A new immutable instance template resource is created in the GCP project.
Compute Engine instance templates cannot be edited once created.
2
Associate the new template with the Managed Instance Group.
The target instance template property of the MIG is updated.
The MIG manager requires an updated template reference before performing a rolling deployment.
3
Initiate the rolling update via gcloud CLI.
The MIG manager begins stopping and recreating instances according to the update policy.
Rolling updates replace instances systematically to preserve application availability.
4
Wait for the instance group to stabilize.
Confirmation that all instances in the group have been successfully updated and are passing health checks.
Verifying stability guarantees the update finished successfully without rolling back or stalling.

Key Concept

Managed Instance Group Rolling Updates and Instance Template Immutability
Rate this question