Your organization needs to perform a zero-downtime update of a production stateless web application hosted on a Compute Engine Managed Instance Group (MIG). Place the operational steps in the correct sequential order to deploy the new application version according to Google Cloud best practices.
- 1Create a new Compute Engine instance template specifying the updated boot disk image and container configuration.
- 2Update the Managed Instance Group configuration to set the target instance template to the newly created instance template.
- 3Execute `gcloud compute instance-groups managed rolling-action replace` with designated `max-surge` and `max-unavailable` parameters.
- 4Monitor instance health checks and verify using `gcloud compute instance-groups managed list-instances` until all instances reach the `UPDATED` state.
Answer
The correct sequence for updating the Managed Instance Group with zero downtime is: 1) Create a new instance template containing the updated configuration, 2) Set the MIG target instance template to the new template, 3) Execute a rolling replace command with surge and unavailability constraints, and 4) Monitor instance health checks until all instances reach the UPDATED state.
Because Compute Engine instance templates are immutable, updating a Managed Instance Group (MIG) requires creating a new instance template first. Once created, the MIG target instance template reference must be updated to point to this new template. After updating the target reference, running a `rolling-action replace` command with defined `max-surge` and `max-unavailable` parameters starts the automated rollout while preserving application capacity. Finally, monitoring instance health checks ensures all new instances successfully serve traffic and transition to the `UPDATED` state.
Step-by-Step Solution
Key Concept
Managed Instance Group (MIG) Rolling Updates and Instance Template Lifecycle Management