kubectl-plugins

nodepool

Manage AKS node pools (also available as kubectl np).

kubectl nodepool <command> [NAME] [flags]
kubectl np <command> [NAME] [flags]

Uses the shared AKS flags. Mutating commands wait for completion unless --no-wait is set.

Commands

CommandDescription
listList node pools
show NAMESummary of one pool
describe NAMEFull properties plus latest node image and available upgrade versions
add NAMECreate a pool
delete NAMEDelete a pool (asks to confirm unless -y)
scale NAME --count NSet the node count
update NAMEChange autoscaler, labels, taints, max surge or mode
upgrade NAME --kubernetes-version VUpgrade the Kubernetes version
upgrade-node-image NAMEUpgrade the node image
start NAME / stop NAMEStart or stop a pool
taint NAME SPEC...Add or remove taints
untaint NAME KEY[:EFFECT]...Remove taints
cancel-operation NAMECancel the latest operation

add

kubectl nodepool add gpu --vm-size Standard_NC6s_v3 \
  --enable-cluster-autoscaler --min-count 1 --max-count 5 \
  --labels team=ml --taints sku=gpu:NoSchedule

Flags: --vm-size, --count, --mode User|System, --kubernetes-version, --labels, --taints, --enable-cluster-autoscaler, --min-count, --max-count, --max-surge, --os-type, --max-pods, --zones, --vnet-subnet-id, --os-disk-size.

scale and the autoscaler

scale refuses a pool that has the cluster autoscaler enabled. Use update to change --min-count and --max-count, or disable the autoscaler first:

kubectl nodepool update userpool --enable-cluster-autoscaler --min-count 2 --max-count 6
kubectl nodepool update userpool --disable-cluster-autoscaler

Taints

taint uses kubectl’s syntax. A trailing - removes.

kubectl nodepool taint gpu sku=gpu:NoSchedule    # add (replaces same key and effect)
kubectl nodepool taint gpu sku-                  # remove every taint with key sku
kubectl nodepool taint gpu sku:NoSchedule-       # remove one
kubectl nodepool untaint gpu sku:NoSchedule      # same as the line above

Effects are NoSchedule, PreferNoSchedule and NoExecute. Removing a taint that does not exist is an error. update --taints replaces the whole list instead; an empty value clears it.