Azure Kubernetes (AKS) - add label to existing node pool
In our cluster we have custom admission webhoot that performs certain number of checks one of which is requirement for deployments to define node selector
And for very old project to experiment we have added windows node pool but forget to add node label
Here is how it can be fixed:
# STEP 0: AZ CLI
# current
az account show --query name --output tsv
# available
az account list --query "[].{name:name}" --output tsv
# change
az account set --subscription="mysubscription"
# STEP 1: Add label to existing AKS node pool
# list clusters
az aks list --query "[].{Name:name,ResourceGroup:resourceGroup}" --output table
CLUSTER_NAME=mycluster
RESOURCE_GROUP=myrg
# list node pools
az aks nodepool list --cluster-name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --query "[].{name:name}" --output tsv
POOL_NAME=win
# update labels - note old labels will be overwritten
az aks nodepool update --resource-group $RESOURCE_GROUP --cluster-name $CLUSTER_NAME --name $POOL_NAME --labels poolDestination=win
From what I see it seems that this operation is quite fast and does not require any downtime