|
| 1 | +--- |
| 2 | +title: Rolling upgrades with MaxSurge for Virtual Machine Scale Sets (preview) |
| 3 | +description: Learn about how to utilize rolling upgrades with MaxSurge on Virtual Machine Scale Sets. |
| 4 | +author: mimckitt |
| 5 | +ms.author: mimckitt |
| 6 | +ms.topic: overview |
| 7 | +ms.service: virtual-machine-scale-sets |
| 8 | +ms.date: 7/19/2024 |
| 9 | +ms.reviewer: ju-shim |
| 10 | +ms.custom: upgradepolicy |
| 11 | +--- |
| 12 | +# Rolling upgrades with MaxSurge on Virtual Machine Scale Sets (Preview) |
| 13 | + |
| 14 | +> [!NOTE] |
| 15 | +> Rolling upgrades with MaxSurge for Virtual Machine Scale Sets with Uniform Orchestration is in general availability (GA). |
| 16 | +> |
| 17 | +> **Rolling upgrades with MaxSurge for Virtual Machine Scale Sets with Flexible Orchestration is currently in preview.** |
| 18 | +> |
| 19 | +> Previews are made available to you on the condition that you agree to the [supplemental terms of use](https://azure.microsoft.com/support/legal/preview-supplemental-terms/). Some aspects of these features may change prior to general availability (GA). |
| 20 | +
|
| 21 | +Rolling upgrades with MaxSurge can help improve service uptime during upgrade events. |
| 22 | + |
| 23 | +With MaxSurge enabled, new instances are created in batches using the latest scale model. When the batch of new instances are fully created and healthy, they begin taking traffic. The scale set then deletes instances in batches matching the old scale set model. The process continues until all instances are brought up-to-date. |
| 24 | + |
| 25 | + |
| 26 | +## How it works |
| 27 | + |
| 28 | +Rolling upgrades with MaxSurge creates new instances with the latest scale set model to replace instances running with the old model. By creating new instances, you can ensure that your scale set capacity doesn't drop below the set instance count during the duration of the upgrade process. |
| 29 | + |
| 30 | +:::image type="content" source="./media/upgrade-policy/maxsurge-upgrade.png" alt-text="Diagram that shows the process of performing a rolling upgrade with MaxSurge."::: |
| 31 | + |
| 32 | + |
| 33 | +## Configure rolling upgrades with MaxSurge |
| 34 | +Enabling or disabling MaxSurge can be done at any point in time. This includes during or after scale set provisioning. When using a rolling upgrade policy, the scale set must also use the [Application Health Extension](virtual-machine-scale-sets-health-extension.md) have a [health probe](../load-balancer/load-balancer-custom-probe-overview.md). It's suggested to create the scale set with a manual upgrade policy and update the policy to rolling after successfully confirming the application health is being properly reported. |
| 35 | + |
| 36 | + |
| 37 | +### [Portal](#tab/portal) |
| 38 | + |
| 39 | +Select the Virtual Machine Scale Set you want to change the upgrade policy for. In the menu under **Settings**, select **Upgrade Policy** and from the drop-down menu, select **Rolling - Upgrades roll out in batches with optional pause**. |
| 40 | + |
| 41 | +:::image type="content" source="../virtual-machine-scale-sets/media/upgrade-policy/rolling-upgrade-policy-portal.png" alt-text="Screenshot showing updating the upgrade policy and enabling MaxSurge in the Azure portal."::: |
| 42 | + |
| 43 | +### [CLI](#tab/cli) |
| 44 | +Update an existing Virtual Machine Scale Set using [az vmss update](/cli/azure/vmss#az-vmss-update). |
| 45 | + |
| 46 | +```azurecli-interactive |
| 47 | +az vmss update \ |
| 48 | + --name myScaleSet \ |
| 49 | + --resource-group myResourceGroup \ |
| 50 | + --set upgradePolicy.mode=Rolling \ |
| 51 | + --max-batch-instance-percent 10 \ |
| 52 | + --max-unhealthy-instance-percent 20 \ |
| 53 | + --max-unhealthy-upgraded-instance-percent 20 \ |
| 54 | + --prioritize-unhealthy-instances true \ |
| 55 | + --pause-time-between-batches PT2S \ |
| 56 | + --max-surge true |
| 57 | +
|
| 58 | +``` |
| 59 | + |
| 60 | +### [PowerShell](#tab/powershell) |
| 61 | +Update an existing Virtual Machine Scale Set using [Update-AzVmss](/powershell/module/az.compute/update-azvmss). |
| 62 | + |
| 63 | +```azurepowershell-interactive |
| 64 | +$vmss = Get-AzVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" |
| 65 | +
|
| 66 | +Set-AzVmssRollingUpgradePolicy ` |
| 67 | + -VirtualMachineScaleSet $VMSS ` |
| 68 | + -MaxBatchInstancePercent 20 ` |
| 69 | + -MaxUnhealthyInstancePercent 20 ` |
| 70 | + -MaxUnhealthyUpgradedInstancePercent 20 ` |
| 71 | + -PauseTimeBetweenBatches "PT30S" ` |
| 72 | + -EnableCrossZoneUpgrade True ` |
| 73 | + -PrioritizeUnhealthyInstance True ` |
| 74 | + -MaxSurge True |
| 75 | +
|
| 76 | +Update-Azvmss -ResourceGroupName "myResourceGroup" ` |
| 77 | + -Name "myScaleSet" ` |
| 78 | + -UpgradePolicyMode "Rolling" ` |
| 79 | + -VirtualMachineScaleSet $vmss |
| 80 | +``` |
| 81 | + |
| 82 | +### [ARM Template](#tab/template) |
| 83 | + |
| 84 | +Update the properties section of your ARM template and set the upgrade policy to rolling and various rolling upgrade options. |
| 85 | + |
| 86 | + |
| 87 | +``` ARM Template |
| 88 | +"properties": { |
| 89 | + "singlePlacementGroup": false, |
| 90 | + "upgradePolicy": { |
| 91 | + "mode": "Rolling", |
| 92 | + "rollingUpgradePolicy": { |
| 93 | + "maxBatchInstancePercent": 20, |
| 94 | + "maxUnhealthyInstancePercent": 20, |
| 95 | + "maxUnhealthyUpgradedInstancePercent": 20, |
| 96 | + "pauseTimeBetweenBatches": "PT2S", |
| 97 | + "MaxSurge": "true" |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | +``` |
| 102 | +--- |
| 103 | +## Frequently asked questions |
| 104 | + |
| 105 | +### Is MaxSurge generally available for Virtual Machine Scale Sets with Uniform Orchestration? |
| 106 | +Yes. All upgrade policies including rolling upgrades with MaxSurge are generally available for Virtual Machine Scale Sets with Uniform Orchestration. |
| 107 | + |
| 108 | + |
| 109 | +### Is MaxSurge generally available for Virtual Machine Scale Sets with Flexible Orchestration? |
| 110 | +No. All upgrade policies including rolling upgrades with MaxSurge are in Public Preview for Virtual Machine Scale Sets with Flexible Orchestration. |
| 111 | + |
| 112 | +### Do MaxSurge upgrades require more quota? |
| 113 | +Yes. When using rolling upgrades with MaxSurge, new virtual machines are created using the latest scale set model to replace virtual machines using the old scale set model. These newly created virtual machines counts towards your overall core quota. |
| 114 | + |
| 115 | +### Do MaxSurge upgrades require additional IP addresses? |
| 116 | +Yes. These newly created virtual machines have new IP addresses and count towards your total allowed IP addresses available per your subscription. |
| 117 | + |
| 118 | +### Do MaxSurge upgrades require additional subnet space? |
| 119 | +Yes. These newly created virtual machines have new IP addresses and there needs to be enough space available in the specified subnet to be added. |
| 120 | + |
| 121 | +### What triggers a MaxSurge upgrade? |
| 122 | +Any changes that result in an update to the scale set model result in a MaxSurge upgrade. This includes upgrades that generally don't require a restart such as adding Data Disks. |
| 123 | + |
| 124 | +### Can I cancel a MaxSurge upgrade? |
| 125 | +Yes. The process of canceling a MaxSurge upgrade is the same as canceling an in place rolling upgrade. You can stop the upgrade from the Azure portal, CLI, PowerShell, or any other SDK. |
| 126 | + |
| 127 | +### What happens if the newly created virtual machine enters a failed state during a MaxSurge upgrade? |
| 128 | +During a MaxSurge upgrade, new virtual machines are created to replace virtual machines running the old model. If the newly created virtual machine fails to enter a healthy state, that virtual machine is deleted and the rolling upgrade is canceled. |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | +## Next steps |
| 133 | +Learn how to [set the upgrade policy](virtual-machine-scale-sets-set-upgrade-policy.md) of your Virtual Machine Scale Set. |
| 134 | + |
0 commit comments