Introduction
In this article, we would try to understand more about Manage Instance Group. We would also see features of Manage Instance Group like Auto Scaling, Auto Healing, and canary deployment.
In this article, we will cover the following topics:
- What is Managed Instance Group
- How to Create Manage Instance Group
- Working with Manage instance group Auto Scaling, Auto Healing
- Working with Rolling Updates and Canary Deployment.
Prerequisites
In this article, we would not cover step-by-step VM creation since it was already covered in the previous 2 articles.
Kindly refer below articles for a depth understanding of VM creation and management in Google Cloud.
Step 1. What is Managed Instance Group
A group of VM machines working as a single entity created using an instance template is called a Managed Instance Group.
Features of MIG
- Auto Scaling
- Auto healing
- Rolling updates and Canary deployments
Step 2. How to Create Manage Instance Group
For creating a MIG we would first need an instance template
Click on create new MI. There would be two options
- Stateless: Select this option for stateless workloads like web applications, API
- Stateful: Select this option for stateful workloads like web Database
Step 3. Working with Manage instance group Auto Scaling, Auto Healing
Configure Autoscaling
Select autoscaling mode. The selected mode will add or remove instances depending on the signal.
Select minimum and maximum instances range.
This configuration is used by auto-scaling to scale up or scale down based on auto-scaling signal within the threshold of minimum and maximum range.
Auto Scaling Signal
Auto Scaling signal determines the signal that would trigger auto-scaling.
In this example, it is based on CPU utilization.
Configure the Cool down period. The cool down period decides the cool down time before auto-scaling signal would trigger.
VM instance lifecycle is kept as the default setting.
Configure Health Checkup
Health check-up determines the health of VM instances in MIG. If any unhealthy instance is found it would be replaced with a new VM instance.
Select Protocal as http and port 80. The health check mechanism would ping on this port to check for healthy instances.
Health check calls can be logged into the cloud logging mechanism. We have set this to off for this example.
Configure health criteria
- Check Interval: Interval between health check-up
- Timeout: How long to wait before a request is considered a failure
- Healthy threshold: Consecutive success to mark VM as healthy
- Unhealthy threshold: Consecutive failures to mark VM as unhealthy.
Once all the above configurations are done click on create
It will take some time for MIG to be ready for use
Step 4. Working with Rolling Updates and Canary Deployment
Click on Update VMS and select an existing new template.
Underlying VM instances would be updated with the new configuration specified in template instance 2
Specify target size.
The new template would only be updated in the specified target Size.
Update type Automatic would apply the updates proactively.
Summary
In this article, we have learned how to create and manage Managed Instance Group in Google Cloud.
In upcoming articles, we would learn about the Google Kubernetes engine and cloud functions.
Thanks a lot for reading. I hope you liked this article. Please share your valuable suggestions and feedback. Write in the comment box in case you have any questions. Have a good day!