Here is interesting article - Release Release 2020-04-13 · Azure/AKS · GitHub. You can find that "AKS now allows User nodepools to scale to 0" in the article. This feature enables to reduce AKS cost in your environments. I believe you would try to change node count by using az command, but it won't work well at this time - 5/1/2020. Please note this setting is possible for only User mode node pools not System mode.
$subcriptionId = "YOUR SUBSCRIPTION ID" $rg = "YOUR RESOURCE GROUP" $clustername = "YOUR AKS CLUSTER NAME" $poolname = "YOUR NODE POOL NAME" $count = 0 az aks scale --resource-group $rg --name $clustername --node-count $count --nodepool-name $poolname
This issue is caused that az command doesn't support to setup zero node count for user mode node pools at this time. There are two options to achieve this setting here.
- Change node count on https://resources.azure.com/
- Use REST API to change node count
Change node count on https://resources.azure.com/
Open https://resources.azure.com/ and find your user mode node pool of your AKS clusters. Put "Edit" button to enable to change Azure resources setting and edit value of "count" as zero.
Please note this setting is possible only User mode node pools. It will fail to change node count into zero for System mode node pools.
Use REST API to change node count
You can REST API by using az command. Here is example to setup zero node count for user mode node pools.
$subcriptionId = "YOUR SUBSCRIPTION ID" $rg = "YOUR RESOURCE GROUP" $clustername = "YOUR AKS CLUSTER NAME" $poolname = "YOUR NODE POOL NAME" $count = 0 $body = "{ \`"properties\`": { \`"count\`": ${count} } }" $header = "{\`"Content-Type\`": \`"application/json\`"}" az rest -u "https://management.azure.com/subscriptions/${subcriptionId}/resourceGroups/${rg}/providers/Microsoft.ContainerService/managedClusters/${clustername}/agentPools/${poolname}?api-version=2020-03-01" --method put --headers $header --body $body
You can confirm this setting on Azure Portal.