I have statefulset which is deployed accross 2 different nodepools in AKS. I have total of 5 replicas, 2 on nodepool1
and 3 on nodepool2
. I need only 3 to be on nodepool2
and scale it down to just 3 replicas. Is it possible to do? I tried manually to cordon and drain ones on nodepool1
but statefulset refuses to scale down since pod0 is on nodepool1
and refuses to drained from there.
2
Label nodes in your node pools:
NodePool1: nodepool=nodepool1
NodePool2: nodepool=nodepool2
Update the StatefulSet to add affinity to force Pods to run only on nodepool2.
spec:
template:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: nodepool
operator: In
values:
- nodepool2
Vivek Kushwah is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.