Availability sets and managed disks
Availability sets and managed disks complement each other. When the VM uses managed disks and is placed in an availability set (known as an aligned availability set), it ensures that the VM disks are placed in different storage fault domains, as shown in Figure 3-32. This alignment ensures that all the managed disks attached to a VM are within the same managed disk fault domain. The number of fault domains for an availability set depends on the region it belongs to, with either two or three fault domains per region.
FIGURE 3-32 Aligning managed disks with an availability set
Deploy and configure Virtual Machine Scale Sets
A Virtual Machine Scale Set (VMSS) is a compute resource that you can use to deploy and man- age a set of identical virtual machines.
By default, a VMSS supports up to 100 instances. However, it is possible to create a scale set up to 1,000 instances by placing instances into multiple placement groups. A placement group is a construct, such as an Azure availability set, with its own fault domains and upgrade domains. If you define an instance count that is higher than 100 in the Azure portal when the scale set is created, the Azure portal will automatically enable the scale set for multiple placement groups. By default, a scale set consists of a single placement group with a maximum size of 100 VMs. If the scale set property called singlePlacementGroup is set to false or if you define an instance count higher than 100 in the Azure portal, the scale set can be composed of multiple placement groups and has a range of 0-1,000 VMs.
Using multiple placement groups is commonly referred to as a “large scale set.” The singlePlacementGroup property can be set using ARM templates or the command-line tools. Be aware of the following conditions when working with large scale sets:
- If you are using a custom image (not a default available image from marketplace), your scale set supports up to 600 instances instead of 1,000.
- The basic SKU of the Azure Load Balancer can scale up to 300 instances.
- For a large scale set (> 100 instances), you should use the Standard SKU (supports up to 1,000 instances) or the Azure Application Gateway.
Figure 3-33 shows a portion of the blade for creating a new virtual machine scale set (VMSS) using the Azure portal. Like other Azure resources, you must specify a name and the resource group to deploy to. All instances of the VMSS will use the same operating system disk image specified here.
EXAM TIP
A scale set can be deployed to an availability zone to provide higher redundancy and resiliency. If the scale set is created with a single availability zone, then all the instances will be deployed within a single zone. If the scale set is deployed in multiple availability zones (known as a zone-redundant scale set), based on scaling rules, the instances can be deployed to multiple zones if needed.
On the Scaling tab, you can configure the Scaling Policy as Manual or Custom. When you set the Scaling Policy to Custom, you see the configuration options for setting the default rules, as shown in Figure 3-34. Here, you can specify the minimum and maximum number of VMs in the set, and you can set the actions to scale out (add more) or to scale in (remove instances).
FIGURE 3-33 Creating a VM scale set
FIGURE 3-34 Configuring scaling rules for a virtual machine scale set
During the lifecycle of a virtual machine scale set, you may need to upgrade the instances with the latest scale set model. The VMSS upgrade policy determines how VMs will be upgraded once a new update is available. Three options are available: Automatic, Rolling, and Manual (see Figure 3-35). If you select Automatic, all instances are updated in the random order when an update is available, which can cause downtime. If you select Rolling, the scale set updates VMs in multiple batches, and you can set a pause time between two batches, which can avoid total downtime. If the property is set to Manual, it is up to you to programmatically step through and update each instance using PowerShell with the Update-AzVmssInstance cmdlet or the Azure CLI az vmss update-instances command.
FIGURE 3-35 Configuring management rules for a virtual machine scale set
You can also add a layer of health monitoring to your application when you create VMSS. Health monitoring is required when you plan to use managed infrastructure and automatic operating system upgrades. On the Health tab, you can enable application health monitoring and configure options by choosing the extension, protocol, port, and application endpoint path (see Figure 3-36).
Some options on the Advanced tab, such as Allocation Policy, include a spreading algo- rithm. Also, you can select among options such as Extensions, VM application, and Proximity Placement Group, as shown in Figure 3-37.
FIGURE 3-36 Configuring health monitoring for a virtual machine scale set
FIGURE 3-37 Configuring advanced rules for a virtual machine scale set
EXAM TIP
The spreading algorithm determines how scale set instances will be placed in a fault domain. With max spreading, the instances are distributed in the maximum fault domains possible for each zone. Fixed spreading restricts instances to exactly five fault domains. If a scale set is using a fixed spreading algorithm and there are fewer than five fault domains available, the deployment will fail.