What can be the causes of VMSS going to unhealthy?
There could be scaling issues, deployment issues or even the extension issues that can make a VMSS to get into unhealthy state. Here are some examples of such issues
https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-quota-exceeded
https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machine-scale-sets/vmss-public-ip-count-limit-exceeded
https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machine-scale-sets/vm-extension-provisioning-errors
What is automatic instance repair?
Enabling automatic instance repairs for Azure virtual machine scale sets helps achieve high availability for applications by maintaining a set of healthy instances. If an instance in the scale set is found to be unhealthy as reported by Application Health extension or Load balancer health probes, then this feature automatically performs instance repair by deleting the unhealthy instance and creating a new one to replace it.
How do automatic instance repairs work?
Automatic instance repair feature relies on health monitoring of individual instances in a scale set. VM instances in a scale set can be configured to emit application health status using either the Application Health extension or Load balancer health probes. If an instance is found to be unhealthy, then the scale set performs repair action by deleting the unhealthy instance and creating a new one to replace it. The latest virtual machine scale set model is used to create the new instance. This feature can be enabled in the virtual machine scale set model by using the automaticRepairsPolicy object. Reference: https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-automatic-instance-repairs
What is Reimage Operation in VMSS? How it works? Is it initiated by Azure platform or customer?
If you select reimage, it will remove the VMSS instance and replace it with a brand new one. This can be used if you are having issues with a single instance and want to essentially delete it and redeploy it.
Please refer to this TPA link for more details https://negatblog.wordpress.com/2018/06/05/reimaging-vms-in-a-scale-set/
Please give me a brief idea of VMSS working? How it creates instances automatically?
A virtual machine scale set allows you to deploy and manage a set of auto-scaling virtual machines. You can scale the number of VMs in the scale set manually or define rules to autoscale based on resource usage like CPU, memory demand, or network traffic. An Azure load balancer then distributes traffic to the VM instances in the scale set. In this quickstart, you create a virtual machine scale set in the Azure portal.
Hope this helps, if you have any further queries feel free to tag me in your comments.
(If the response was helpful, would you be so kind to accept my response as answer, so that the relevancy of this post will improve when anyone in the community search for similar query.)