Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In Azure Kubernetes Service (AKS), nodes of the same configuration are grouped together into node pools. These node pools contain the underlying VMs that run your applications. When you create an AKS cluster, you define the initial number of nodes and their size (SKU), which creates a system node pool.
To support applications that have different compute or storage demands, you can create user node pools. System node pools serve the primary purpose of hosting critical system pods such as CoreDNS and konnectivity
. User node pools serve the primary purpose of hosting your application pods. For example, use more user node pools to provide GPUs for compute-intensive applications, or access to high-performance SSD storage. However, if you wish to have only one pool in your AKS cluster, you can schedule application pods on system node pools.
Note
This feature enables more control over creating and managing multiple node pools and requires separate commands for create/update/delete (CRUD) operations. Previously, cluster operations through az aks create
or az aks update
used the managedCluster API and were the only options to change your control plane and a single node pool. This feature exposes a separate operation set for agent pools through the agentPool API and requires use of the az aks nodepool
command set to execute operations on an individual node pool.
This article shows you how to create one or more node pools in an AKS cluster.
az --version
to find the version. If you need to install or upgrade, see Install Azure CLI.The following limitations apply when you create AKS clusters that support multiple node pools:
Important
If you run a single system node pool for your AKS cluster in a production environment, we recommend you use at least three nodes for the node pool. If one node goes down, the redundancy is compromised. You can mitigate this risk by having more system node pool nodes.
Create an Azure resource group using the az group create
command.
az group create --name $RESOURCE_GROUP_NAME --location $LOCATION
Create an AKS cluster with a single node pool using the az aks create
command.
az aks create \
--resource-group $RESOURCE_GROUP_NAME \
--name $CLUSTER_NAME \
--vm-set-type VirtualMachineScaleSets \
--node-count 2 \
--location $LOCATION \
--load-balancer-sku standard \
--generate-ssh-keys
It takes a few minutes to create the cluster.
When the cluster is ready, get the cluster credentials using the az aks get-credentials
command.
az aks get-credentials --resource-group $RESOURCE_GROUP_NAME --name $CLUSTER_NAME
The cluster created in the previous step has a single node pool. In this section, we add a second node pool to the cluster.
Create a new node pool using the az aks nodepool add
command. The following example creates a node pool named mynodepool that runs three nodes:
az aks nodepool add \
--resource-group $RESOURCE_GROUP_NAME \
--cluster-name $CLUSTER_NAME \
--name $NODE_POOL_NAME \
--node-count 3
Check the status of your node pools using the az aks node pool list
command and specify your resource group and cluster name.
az aks nodepool list --resource-group $RESOURCE_GROUP_NAME --cluster-name $CLUSTER_NAME
The following example output shows mynodepool has been successfully created with three nodes. When the AKS cluster was created in the previous step, a default nodepool1 was created with a node count of 2.
[
{
...
"count": 3,
...
"name": "mynodepool",
"orchestratorVersion": "1.15.7",
...
"vmSize": "Standard_DS2_v2",
...
},
{
...
"count": 2,
...
"name": "nodepool1",
"orchestratorVersion": "1.15.7",
...
"vmSize": "Standard_DS2_v2",
...
}
]
The ARM64 processor provides low power compute for your Kubernetes workloads. To create an ARM64 node pool, you need to choose a Dpsv5, Dplsv5 or Epsv5 series Virtual Machine.
Add an ARM64 node pool into your existing cluster using the az aks nodepool add
.
az aks nodepool add \
--resource-group $RESOURCE_GROUP_NAME \
--cluster-name $CLUSTER_NAME \
--name $ARM_NODE_POOL_NAME \
--node-count 3 \
--node-vm-size Standard_D2pds_v5
The Azure Linux container host for AKS is an open-source Linux distribution available as an AKS container host. It provides high reliability, security, and consistency. It only includes the minimal set of packages needed for running container workloads, which improve boot times and overall performance.
Add an Azure Linux node pool into your existing cluster using the az aks nodepool add
command and specify --os-sku AzureLinux
.
az aks nodepool add \
--resource-group $RESOURCE_GROUP_NAME \
--cluster-name $CLUSTER_NAME \
--name $AZ_LINUX_NODE_POOL_NAME \
--os-sku AzureLinux
You can migrate your existing Ubuntu nodes to Azure Linux using one of the following methods:
A workload may require splitting cluster nodes into separate pools for logical isolation. Separate subnets dedicated to each node pool in the cluster can help support this isolation, which can address requirements such as having noncontiguous virtual network address space to split across node pools.
Note
Make sure to use Azure CLI version 2.35.0
or later.
aks-preview
Azure CLI extension (version 0.5.66 and higher) now supports running az aks update
command with only the required -g <resourceGroup> -n <clusterName>
arguments. This command performs an update operation without making any changes, which can recover a cluster stuck in a failed state.Add a node pool with a unique subnet into your existing cluster using the az aks nodepool add
command and specify the --vnet-subnet-id
.
az aks nodepool add \
--resource-group $RESOURCE_GROUP_NAME \
--cluster-name $CLUSTER_NAME \
--name $NODE_POOL_NAME \
--node-count 3 \
--vnet-subnet-id $SUBNET_RESOURCE_ID
For more information on enabling Federal Information Process Standard (FIPS) for your AKS cluster, see Enable Federal Information Process Standard (FIPS) for Azure Kubernetes Service (AKS) node pools.
Beginning in Kubernetes version 1.20 and higher, you can specify containerd
as the container runtime for Windows Server 2019 node pools. Starting with Kubernetes 1.23, containerd
is the default and only container runtime for Windows.
Important
When using containerd
with Windows Server 2019 node pools:
--node-vm-size
is Standard_D2s_v3, which was minimum recommended size for Windows Server 2019 node pools prior to Kubernetes version 1.20. The minimum recommended size for Windows Server 2019 node pools using containerd
is Standard_D4s_v3. When setting the --node-vm-size
parameter, check the list of restricted VM sizes.containerd
and tolerations or node selectors with your deployments to guarantee your workloads are scheduled correctly.Add a Windows Server node pool with containerd
into your existing cluster using the az aks nodepool add
.
Note
If you don't specify the WindowsContainerRuntime=containerd
custom header, the node pool still uses containerd
as the container runtime by default.
az aks nodepool add \
--resource-group $RESOURCE_GROUP_NAME \
--cluster-name $CLUSTER_NAME \
--os-type Windows \
--name $CONTAINER_D_NODE_POOL_NAME \
--node-vm-size Standard_D4s_v3 \
--kubernetes-version 1.20.5 \
--aks-custom-headers WindowsContainerRuntime=containerd \
--node-count 1
Upgrade a specific node pool from Docker to containerd
using the az aks nodepool upgrade
command.
az aks nodepool upgrade \
--resource-group $RESOURCE_GROUP_NAME \
--cluster-name $CLUSTER_NAME \
--name $CONTAINER_D_NODE_POOL_NAME \
--kubernetes-version 1.20.7 \
--aks-custom-headers WindowsContainerRuntime=containerd
Upgrade all node pools from Docker to containerd
using the az aks nodepool upgrade
command.
az aks nodepool upgrade \
--resource-group $RESOURCE_GROUP_NAME \
--cluster-name $CLUSTER_NAME \
--kubernetes-version 1.20.7 \
--aks-custom-headers WindowsContainerRuntime=containerd
Add a node pool that uses Ephemeral OS disks to an existing cluster using the az aks nodepool add
command with the --node-osdisk-type
flag set to Ephemeral
.
Note
--node-osdisk-type
flag with the az aks create
command.--node-osdisk-type Managed
.az aks nodepool add --name $EPHEMERAL_NODE_POOL_NAME --cluster-name $CLUSTER_NAME --resource-group $RESOURCE_GROUP_NAME -s Standard_DS3_v2 --node-osdisk-type Ephemeral
Important
With Ephemeral OS, you can deploy VMs and instance images up to the size of the VM cache. The default node OS disk configuration in AKS uses 128 GB, which means that you need a VM size that has a cache larger than 128 GB. The default Standard_DS2_v2 has a cache size of 86 GB, which isn't large enough. The Standard_DS3_v2 VM SKU has a cache size of 172 GB, which is large enough. You can also reduce the default size of the OS disk by using --node-osdisk-size
, but keep in mind the minimum size for AKS images is 30 GB.
If you no longer need a node pool, you can delete it and remove the underlying VM nodes.
Caution
When you delete a node pool, AKS doesn't perform cordon and drain, and there are no recovery options for data loss that may occur when you delete a node pool. If pods can't be scheduled on other node pools, those applications become unavailable. Make sure you don't delete a node pool when in-use applications don't have data backups or the ability to run on other node pools in your cluster. To minimize the disruption of rescheduling pods currently running on the node pool you want to delete, perform a cordon and drain on all nodes in the node pool before deleting.
Delete a node pool using the az aks nodepool delete
command and specify the node pool name.
az aks nodepool delete --resource-group $RESOURCE_GROUP_NAME --cluster-name $CLUSTER_NAME --name $NODE_POOL_NAME --no-wait
It takes a few minutes to delete the nodes and the node pool.
In this article, you learned how to create multiple node pools in an AKS cluster. To learn about how to manage multiple node pools, see Manage multiple node pools for a cluster in Azure Kubernetes Service (AKS).
Azure Kubernetes Service feedback
Azure Kubernetes Service is an open source project. Select a link to provide feedback:
Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Optimize compute costs on Azure Kubernetes Service (AKS) - Training
Explore strategies that you can use on Azure to optimize your cloud-native application-development process by using Azure Kubernetes Service (AKS).