Skip to content

Files

Latest commit

95417d6 · Apr 20, 2021

History

History
91 lines (69 loc) · 3.43 KB

scale-cluster.md

File metadata and controls

91 lines (69 loc) · 3.43 KB
title description services ms.topic ms.date
Scale an Azure Kubernetes Service (AKS) cluster
Learn how to scale the number of nodes in an Azure Kubernetes Service (AKS) cluster.
container-service
article
09/16/2020

Scale the node count in an Azure Kubernetes Service (AKS) cluster

If the resource needs of your applications change, you can manually scale an AKS cluster to run a different number of nodes. When you scale down, nodes are carefully cordoned and drained to minimize disruption to running applications. When you scale up, AKS waits until nodes are marked Ready by the Kubernetes cluster before pods are scheduled on them.

Scale the cluster nodes

First, get the name of your node pool using the az aks show command. The following example gets the node pool name for the cluster named myAKSCluster in the myResourceGroup resource group:

az aks show --resource-group myResourceGroup --name myAKSCluster --query agentPoolProfiles

The following example output shows that the name is nodepool1:

[
  {
    "count": 1,
    "maxPods": 110,
    "name": "nodepool1",
    "osDiskSizeGb": 30,
    "osType": "Linux",
    "storageProfile": "ManagedDisks",
    "vmSize": "Standard_DS2_v2"
  }
]

Use the az aks scale command to scale the cluster nodes. The following example scales a cluster named myAKSCluster to a single node. Provide your own --nodepool-name from the previous command, such as nodepool1:

az aks scale --resource-group myResourceGroup --name myAKSCluster --node-count 1 --nodepool-name <your node pool name>

The following example output shows the cluster has successfully scaled to one node, as shown in the agentPoolProfiles section:

{
  "aadProfile": null,
  "addonProfiles": null,
  "agentPoolProfiles": [
    {
      "count": 1,
      "maxPods": 110,
      "name": "nodepool1",
      "osDiskSizeGb": 30,
      "osType": "Linux",
      "storageProfile": "ManagedDisks",
      "vmSize": "Standard_DS2_v2",
      "vnetSubnetId": null
    }
  ],
  [...]
}

Scale User node pools to 0

Unlike System node pools that always require running nodes, User node pools allow you to scale to 0. To learn more on the differences between system and user node pools, see System and user node pools.

To scale a user pool to 0, you can use the az aks nodepool scale in alternative to the above az aks scale command, and set 0 as your node count.

az aks nodepool scale --name <your node pool name> --cluster-name myAKSCluster --resource-group myResourceGroup  --node-count 0 

You can also autoscale User node pools to 0 nodes, by setting the --min-count parameter of the Cluster Autoscaler to 0.

Next steps

In this article, you manually scaled an AKS cluster to increase or decrease the number of nodes. You can also use the cluster autoscaler to automatically scale your cluster.