How to modify a node pool¶
Follow these instructions any time you need to resize, change the VM size, or change the OS of an existing AKS node pool (system or user).
Warning
You can't resize, rename, or change the VM size of an existing node pool
in place. osDiskSizeGB, vmSize, and name are immutable once a pool
exists. Azure rejects any attempt to change them on a live pool. The
only way is to stand up a new pool with the spec you want, migrate
workloads onto it, then delete the old one.
Steps¶
-
Add the new pool. In
platform-infra, editsrc/azure/clusters/inputs.tsand add a new entry tosystemPoolsoruserPoolswith thevmSize/osDiskSizeGB/osSkuyou want. Give it a newname, (personally been following versioning. e.g.syspoolv2becomessyspoolv3). -
PR, merge, deploy. Once it's applied, check that the new node came up:
kubectl get nodesWait until it shows
Ready. -
Cordon the old node so nothing new schedules there:
kubectl cordon <old-node-name> -
Drain it, moving pods onto the new node:
kubectl drain <old-node-name> \ --ignore-daemonsets \ --delete-emptydir-data--ignore-daemonsets: DaemonSet pods (fluent-bit,node-exporter,loki-canary, etc.) run one per node and can't be evicted on their own. They go away once the node itself is deleted.--delete-emptydir-data: needed if anything usesemptyDirvolumes.
PodDisruptionBudget stalls are normal
You'll probably see
Cannot evict pod as it would violate the pod's disruption budgetforkube-systempods (coredns,metrics-server,konnectivity-agent,azure-wi-webhook-controller-manager). Drain retries every few seconds and resolves on its own once a replacement schedules and goesReadyon the new node. Just be patient and it will eventually succeed. -
Check the old node is empty (aside from daemonsets):
kubectl get pods -A -o wide --field-selector spec.nodeName=<old-node-name> -
Remove the old pool from code. Delete its entry from
systemPools/userPoolsininputs.ts, then PR/merge/deploy.Confirm it's gone with:
kubectl get nodes # should no longer see the old nodeor
az aks nodepool list -g k8s --cluster-name k8s-manifests -o table