Minimizing Costs and Ensuring Healthy Instances in Managed Instance Group Deployment

Minimizing Costs and Ensuring Healthy Instances

Question

You have an application controlled by a managed instance group.

When you deploy a new version of the application, costs should be minimized and the number of instances should not increase.

You want to ensure that, when each new instance is created, the deployment only continues if the new instance is healthy.

What should you do?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A.

https://cloud.google.com/compute/docs/instance-groups/rolling-out-updates-to-managed-instance-groups

To ensure that a new instance is healthy before the deployment continues, a rolling-action with maxHealthy set to 1 and maxUnhealthy set to 0 should be performed. This configuration will replace each instance in the managed instance group with a new instance running the updated application version, but only if the new instance passes the health check.

The rolling-action means that instances will be replaced one at a time, minimizing the number of instances that are unavailable at any given time, which helps to reduce costs.

The maxHealthy and maxUnhealthy settings control the percentage of instances in the managed instance group that can be unhealthy or unavailable during the rolling-update process. By setting maxHealthy to 1, the rolling-update will wait for the new instance to become healthy before moving on to the next instance. And by setting maxUnhealthy to 0, the rolling-update will not allow any unhealthy instances during the process, thus ensuring that only healthy instances are serving traffic.

Option A is not correct because maxSurge set to 1 allows an additional instance to be created before the previous instance is deleted, which could result in increased costs.

Option B is also not correct because maxUnavailable set to 1 allows one instance to be unavailable at a time, which could result in increased costs as well.

Option D is not correct because maxHealthy set to 0 and maxUnhealthy set to 1 means that a new instance will be created even if the old instance is unhealthy, which could result in downtime and errors for users.