azure, kubernetes,

Scale AKS user node pool to 0

Sep 06, 2021 · 1 min read · Post a comment

In case you missed Configure AKS automatic upgrades.
In today’s post, we are going to see how can we be cost-effective, by scaling the User node pool to 0.

Prerequisites

  • Azure subscription
  • Azure CLI
  • Azure Kubernetes Service (AKS) cluster

Solution

Step 1. Open Terminal and login to Azure.

az login

Step 2. List the AKS cluster node pool (example):

az aks nodepool list --cluster-name devcoopsAKSCluster --resource-group devcoops --output table

Output:

Name       OsType    VmSize           Count    MaxPods    ProvisioningState    Mode
---------  --------  ---------------  -------  ---------  -------------------  ------
nodepool1  Linux     Standard_DS2_v2  1        110        Succeeded            System
nodepool2  Linux     Standard_DS2_v2  1        110        Succeeded            User

Note(s):

  • nodepoll1: The System node pool type and as the name says, it is hosting the important system pods like CoreDNS.
  • nodepool2: The User node pool and the main purpose is to host the application nodes.

Step 3. Scale the user node pool to 0.

az aks nodepool scale --name nodepool2 --cluster-name devcoopsAKSCluster --resource-group devcoops --node-count 0

Step 4. Validate.

az aks nodepool list --cluster-name devcoopsAKSCluster --resource-group devcoops --output table

Output:

Name       OsType    VmSize           Count    MaxPods    ProvisioningState    Mode
---------  --------  ---------------  -------  ---------  -------------------  ------
nodepool1  Linux     Standard_DS2_v2  1        110        Succeeded            System
nodepool2  Linux     Standard_DS2_v2  0        110        Succeeded            User

The User node pool instance count is successfully set to 0.

Conclusion

Although, you could host your application on the System node pool, it’s not recommended and not a good practice at all. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.