1
votes

I'm trying to set up a continuous delivery pipeline for my ARM templates in Azure. The template contains resource definition for a scale set with some initial number of instances configured and also autoscale rules.

An example of a similar configuration: https://github.com/Azure/azure-quickstart-templates/tree/master/201-vmss-windows-autoscale

The problem I am facing is that every time the template deployment occurs the number of nodes in the scale set is reset to a value specified in the template.

Example: In scale set resource definition there are following values:

"sku": {
         "name": "[parameters('vmSku')]",
         "tier": "Standard",
         "capacity": "3"
       }

And in autoscale settings there are following values:

"capacity": {
              "minimum": "2",
              "maximum": "5",
              "default": "4"
            }

Plus some basic CPU bound rules to scale in and out.

Now let's say under heavy load the autoscale mechanism increases the node count to 5 which is the maximum value. If at that moment I redeploy the same ARM template I used to create the cluster the node count instantly resets back to 3, two nodes go to deleting state and the system needs to scale back again which doesn't make sense to me.

Is there a way to disable this behavior or do I need to maintain two ARM templates, one for initialization and another for update to use in my CD pipeline? What is the best practice?

1

1 Answers

2
votes

no, there is no way to disable this behaviour. it is by design. i dont think there is any viable workaround without using scripts to fetch existing node count and put it into the arm template as a resource, perhaps using reference() function to pull the same value might work, but you'd need a nested template for that