Home > Enterprise >  Disable Auto-Scaling of an AKS Node pool via Azure Powershell
Disable Auto-Scaling of an AKS Node pool via Azure Powershell

Time:03-29

I have an AKS with 3 Node pools - 2 USER type and 1 SYSTEM type. I want to create an automation via Azure runbooks that will scale the 2 USER type Node pools to zero during off-hours and then re-enable auto-scaling to the Node pools with their previous Min and Max count.

As for re-enabling the auto-scaling I found the command for that:

Update-AzAksNodePool -ResourceGroupName $ResourceGroupName -ClusterName $AKSCluster -Name $NodePool -MinCount <Min number> -MaxCount <Max number> -EnableAutoScaling

But as for scaling them to zero, the following commands didn't work:

Update-AzAksNodePool -ResourceGroupName $ResourceGroupName -ClusterName $AKSCluster -Name $NodePool -MinCount 0 -MaxCount 0 

^ For this I get an error that MaxCount value can't be '0'

Update-AzAksNodePool -ResourceGroupName $ResourceGroupName -ClusterName $AKSCluster -Name $NodePool -NodeCount 0

^ For the I don't get any error but it doesn't scale it to 0, basically does nothing.

So after this I realized that the Node pool must be in Manual scaling mode and not Autoscale for the former command to work, which means my script needs to disable the Node pool's auto-scaling or switch it to Manual scaling mode.

This is the documentation I used of the Update-AzAksNodePool command: enter image description here

enter image description here

On the other hand, as we have feature to disable AKS node pool's auto-scaling via enter image description here enter image description here For more information with regards to it, please refer this and this documents.

  • Related