Karpenter consolidation without any downtime for pods

1.1k Views Asked by At

I have karpenter deployed in eks and for karpenter provisioner I have consolidation enabled true

  consolidation:
    enabled: true

which means for any underutilized node, the workload (pods) will be deployed in the existing nodes. but during this process I have noticed karpenter terminates the existing pod and then creates a new pod.

I am looking for a soluction where the new pod will the created in the existing node first and then terminate the pod in the underutilized node then terminate the node.

2

There are 2 best solutions below

1
Jeremy Cowan On
1
Munish On

Karpenter consolidation works by cordoning a node and draining the pods from the node before deleting it. This causes the pods to be evicted and re-created by their controllers in order to be rescheduled. So, a downtime can get introduced.

The available possibilities are:

  • If there is only 1 replica of the pod, then Pod Disruption Budget and annotation karpenter.sh/do-not-evict: true are the ways to stop the node from being terminated.
  • Have multiple replicas of the pod and use node affinity, anti-affinity to have pod replicas placed in separate nodes to have minimum disruption during consolidation.