Interactive diagrams for Kubernetes node autoscaling: provisioning, disruption budgets, bin-packing and spread
Updated for Karpenter v1 (karpenter.sh/v1, docs v1.15)
Karpenter watches for pods the scheduler can't place, works out what capacity they need, and launches a right-sized node, typically in about a minute. You don't need to define node groups in advance.
Removes or replaces nodes that are empty or under-used (consolidation), replaces nodes that no longer match their spec (drift), and retires nodes that have reached their maximum age (expiration).
Limit how many nodes Karpenter may voluntarily disrupt at once, for which reasons, and when. They complement Pod Disruption Budgets (PDBs), which protect each application's pods.
NodePools (what nodes may exist) and NodeClasses (how to build them in your cloud) are Kubernetes custom resources. There are no Auto Scaling Groups: Karpenter calls the cloud provider's API directly.
| Aspect | Cluster Autoscaler | Karpenter |
|---|---|---|
| Unit of scaling | Node groups (ASGs / managed node groups). Each group has one shape | Individual nodes. Every launch can pick a different instance type |
| Instance choice | Fixed per group. Many shapes means many groups | Picks from all types allowed by the NodePool's requirements, sized for the pending pods |
| Speed | Changes the ASG's desired count, then waits for the ASG to launch | Calls the EC2 Fleet API directly |
| Scale-down | Removes nodes below a utilization threshold | Consolidation: deletes nodes or replaces them with cheaper ones |
| Lifecycle management | Outside its scope | Drift, expiration, interruption handling and (alpha) node repair |
Karpenter batches pending pods, matches them to a NodePool, creates a NodeClaim describing the capacity it wants, and the cloud provider launches it using the NodeClass.
Defines which nodes may exist and how they may be disrupted:
Never disables it)apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: general
spec:
template:
spec:
nodeClassRef:
group: karpenter.k8s.aws
kind: EC2NodeClass
name: default
requirements:
- key: karpenter.k8s.aws/instance-category
operator: In
values: ["c", "m", "r"]
- key: karpenter.k8s.aws/instance-generation
operator: Gt
values: ["5"]
- key: kubernetes.io/arch
operator: In
values: ["amd64", "arm64"]
- key: karpenter.sh/capacity-type
operator: In
values: ["spot", "on-demand"]
expireAfter: 720h # 30 days
terminationGracePeriod: 24h
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m
budgets:
- nodes: "10%"
limits:
cpu: "1000"
memory: 1000Gi
weight: 10
Defines how to build the instance on AWS:
alias such as al2023@โฆ or bottlerocket@โฆ, or selection by tags, name, ID or SSM parameterapiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata:
name: default
spec:
amiSelectorTerms:
- alias: al2023@latest # pin al2023@vYYYYMMDD in prod:
# "latest" drifts nodes on every AMI release
role: "KarpenterNodeRole-my-cluster"
subnetSelectorTerms:
- tags:
karpenter.sh/discovery: my-cluster
securityGroupSelectorTerms:
- tags:
karpenter.sh/discovery: my-cluster
blockDeviceMappings:
- deviceName: /dev/xvda
ebs:
volumeSize: 50Gi
volumeType: gp3
โ ๏ธ EKS no longer publishes Amazon Linux 2 AMIs after Kubernetes 1.32, so new clusters should use AL2023 or Bottlerocket.
A NodeClaim is Karpenter's request for one node. When the scheduling simulation decides new capacity is needed, Karpenter creates a NodeClaim listing the compatible instance types. The cloud provider launches one of them, and the NodeClaim then tracks that instance for its whole life.
NodeClaims move through the status conditions Launched โ Registered โ Initialized. They hold the node's expireAfter and terminationGracePeriod, and they are what disruption actually deletes.
$ kubectl get nodeclaims
# example output
NAME TYPE CAPACITY ZONE NODE READY AGE
general-7xk2p m7g.xlarge spot eu-west-1a ip-10-0-41-17... True 3h
general-9qd4t c7i.2xlarge on-demand eu-west-1b ip-10-0-77-203... True 41m
weight whose requirements, taints and limits fit.reserved (capacity reservations) first, then spot, then on-demand.Launched).Registered).Initialized).karpenter.sh/disrupted:NoSchedule.| Method | Kind | Triggered when | Budget reason | Limited by budgets? |
|---|---|---|---|---|
| Consolidation: empty | Graceful | A node has no workload pods (DaemonSets don't count) | Empty | โ Yes |
| Consolidation: underutilized | Graceful | The node's pods fit elsewhere, or on one cheaper replacement | Underutilized | โ Yes |
| Drift | Graceful | The node no longer matches its NodePool or NodeClass (AMI, requirements, settings) | Drifted | โ Yes |
| Node auto repair (alpha) | Graceful | The node stays unhealthy (e.g. Ready=False) past a toleration period | Unhealthy | โ Yes |
| Expiration | Forceful | The node is older than expireAfter | โ | โ No: drains immediately |
| Interruption | Forceful | Spot interruption (2-minute warning), scheduled maintenance, or the instance stopping or terminating | โ | โ No |
| Manual | Manual | kubectl delete node or nodeclaim, or deleting the NodePool | โ | โ No |
Karpenter runs one automated graceful method at a time, in priority order: repair, then drift, then consolidation.
WhenEmpty: only remove nodes with no workload pods.
WhenEmptyOrUnderutilized (default): also remove or replace nodes whose pods fit elsewhere.
Balanced: consolidate only when the estimated savings are worth the disruption to running pods.
consolidateAfter: how long a node must go without pods being added or removed before it's considered. The default is 0s; Never turns consolidation off.
Delete: every pod fits on free capacity elsewhere.
Replace: the pods fit on free capacity plus one cheaper new node.
Order: empty nodes first (in parallel), then several nodes at once, then single nodes.
Spot: delete-only by default. Replacing spot with spot needs the SpotToSpotConsolidation feature gate, and at least 15 allowed instance types for single-node replacement.
karpenter.sh/do-not-disrupt: "true" on a pod stops voluntary disruption of its node. A duration such as "30m" protects the pod for that long after it starts.
On a node, the same annotation blocks voluntary disruption (except repair).
Neither annotation stops expiration, interruption or manual deletion.
Caps how long a node may spend draining. When it runs out, any remaining pods are force-deleted, even pods protected by a PDB or do-not-disrupt.
With a TGP set, drift can also start on nodes whose pods would otherwise block it. A node's maximum lifetime is expireAfter + terminationGracePeriod.
Without a TGP, a blocking PDB can stall a drain indefinitely.
nodes (required: a count such as "3" or a percentage such as "20%"), optional reasons, optional schedule + duration, which must be set together.Empty, Underutilized, Drifted, Unhealthy. A budget without reasons applies to all of them.@daily, @weekly and similar) and are always UTC. A budget is active from each cron match for duration. Without a schedule, it's always active.nodes: "10%".allowed = roundup(total ร pct) โ deleting โ notReady. A count works the same way: n โ deleting โ notReady. NotReady nodes are not subtracted for Unhealthy.Try it: set the budget, then click Start Demo. Five nodes have drifted after an AMI update. Karpenter replaces at most budget nodes at the same time. Each one gets its replacement first, then is drained and terminated. The rest wait until a slot frees up.
spec:
disruption:
budgets:
- nodes: "20%"
reasons: ["Empty", "Drifted"]
- nodes: "5"
- nodes: "0"
schedule: "@daily"
duration: 10m
reasons: ["Underutilized"]
Empty and Drifted: min(20%, 5). Underutilized: 5, except 0 for the first 10 minutes after midnight UTC. (Example from the Karpenter docs.)
spec:
disruption:
budgets:
- nodes: "1" # always active
- nodes: "5" # "more at night"?
schedule: "0 22 * * *"
duration: 8h
At night both budgets are active, and the minimum is 1. The second budget never changes anything.
spec:
disruption:
budgets:
- nodes: "5" # the ceiling: nights/weekends
- nodes: "1" # tighter during the day
schedule: "0 6 * * mon-fri"
duration: 16h # 06:00โ22:00 UTC
Set the loosest limit as the always-on budget, then use schedules to tighten it.
Give workloads with different needs separate NodePools (with taints or node selectors), because budgets are set per NodePool.
Allowed simultaneous disruptions per reason for each hour of the week of 23 Nov 2026 (UTC), computed by evaluating the recipe's budgets with Karpenter's rules. Hover a cell for details.
Expiration and spot interruptions ignore budgets. For a freeze, make sure expireAfter won't fall inside it, and use on-demand capacity for anything that mustn't be interrupted.
A budget of 1 node can still take down every replica if they all sit on that node. Use PDBs plus spread (next tab).
Schedules are UTC-only. Daylight-saving shifts move your window by an hour twice a year, so leave some margin.
Cron can only match a fixed day of the month. Dates of moving events change every year, so put updating them in your release checklist.
Provisioning is a bin-packing problem: fit a batch of pending pods into the cheapest set of instances. Karpenter places the larger pods first and sizes nodes from requests only, plus DaemonSet overhead and the node's reserved resources.
Consolidation re-packs continuously. As pods come and go, nodes end up half-empty, and Karpenter deletes or replaces them so the remaining pods sit on fewer or cheaper nodes.
โ ๏ธ Pack quality depends on your requests. If they're inflated, you pay for empty space. If they're too low, packed nodes get noisy neighbours and OOM kills. Right-size them (VPA recommendations, actual usage).
Packing minimises cost, but it concentrates risk: lose one node or one zone, and you may lose most of a service's replicas.
Spread (topology spread constraints, pod anti-affinity) buys availability with more, smaller, or less-utilised nodes.
Karpenter supports spread over topology.kubernetes.io/zone, kubernetes.io/hostname and karpenter.sh/capacity-type. topology.kubernetes.io/region is not supported. NodePools don't balance zones on their own, so ask for zone spread on the pods.
Karpenter only decides which nodes exist. kube-scheduler picks the node for each pod, and its default scoring (NodeResourcesFit with LeastAllocated) prefers the emptiest node. That spreads pods across nodes and works against consolidation. MostAllocated prefers the fullest node that fits, so nodes empty out and Karpenter can remove them.
If you run your own control plane, set this in KubeSchedulerConfiguration. Managed control planes vary: check whether your provider exposes scheduler configuration (the Karpenter docs describe an option for recent EKS versions).
apiVersion: kubescheduler.config.k8s.io/v1
kind: KubeSchedulerConfiguration
profiles:
- schedulerName: default-scheduler
pluginConfig:
- name: NodeResourcesFit
args:
scoringStrategy:
type: MostAllocated
resources:
- name: cpu
weight: 1
- name: memory
weight: 1
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: web
Karpenter launches nodes in the zones needed to keep the replica counts per zone within 1 of each other. Use it for anything customer-facing.
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: web
Karpenter first treats preferences as required, then relaxes them one at a time if they can't be met. The docs warn that ScheduleAnyway spread can create more nodes than you'd expect.
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app: kafka
For quorum systems (Kafka, ZooKeeper, etcd, databases), where two replicas on one node would turn a single failure into lost quorum.
# NodePool "spot": capacity-spread In ["2","3","4","5"]
# NodePool "on-demand": capacity-spread In ["1"]
topologySpreadConstraints:
- maxSkew: 1
topologyKey: capacity-spread
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: web
Five label values spread evenly gives about 4 parts spot to 1 part on-demand. A custom label on the NodePools makes the ratio a topology.
| Concern | ๐ฆ Bin-pack | ๐ Spread |
|---|---|---|
| Cost | Lowest: fewer, fuller nodes | Higher: more nodes, lower utilization |
| Node failure | Can take out many replicas at once | Takes out โค 1/N of replicas |
| Zone failure | May take out everything if all nodes share a zone | Takes out ~1/3 with 3 zones |
| Consolidation churn | High: nodes empty out and get removed often | Lower, but constraints can block consolidation |
| Noisy neighbours | More contention (CPU, memory bandwidth, network) | Less contention |
| Best for | Batch, CI, dev, stateless workers with many replicas | Customer-facing services, quorum systems, stateful sets |
Common pattern: pack inside each zone, spread across zones. Hard zone spread, soft (or no) node spread, a PDB, and enough replicas that losing one node costs a small fraction of capacity.
| Aspect | ๐ฏ Pod Disruption Budget (PDB) | ๐ Karpenter Disruption Budget |
|---|---|---|
| Scope | Protects individual pods | Controls node removal |
| Unit | minAvailable or maxUnavailable (pods) |
nodes (count or %) |
| Enforced by | The Kubernetes Eviction API | Karpenter's disruption controller |
| Defined on | Each workload (namespace + label selector) | Each NodePool |
| Question answered | "Can I evict this pod?" | "Can I start disrupting another node?" |
| Per-reason / time windows | โ Not supported | โ
reasons, schedule + duration |
| Forceful disruption | Still honoured while draining, until terminationGracePeriod runs out |
Doesn't apply to expiration or interruption |
| Can be overridden | Yes: when the node's terminationGracePeriod runs out, remaining pods are force-deleted |
Not by pods. Only by changing the NodePool |
"Would disrupting another node exceed the NodePool's budget for this reason, right now?"
Taint the node karpenter.sh/disrupted โ launch a replacement โ begin draining
The Eviction API checks each pod: "Would this violate its PDB?"
โ Allowed โ the pod is evicted
โ Denied (HTTP 429) โ Karpenter retries, until the TGP (if set) runs out
Key insight: you need both. PDBs protect each application's availability. Karpenter budgets control how much of the fleet changes at once.
Use maxUnavailable: 1 or a percentage. Avoid minAvailable equal to the replica count: it blocks every drain, and nodes then sit until the TGP force-deletes the pods.
The implicit nodes: "10%" suits most stateless pools. Small or stateful pools are better with a count ("1"), because percentages round up.
Budgets combine by minimum. Put your off-peak rate in the always-on budget, then add scheduled budgets that lower it for peak hours or freezes.
nodes: "0"Block Underutilized and Drifted during critical windows, and still allow Empty so idle capacity keeps getting cleaned up.
Annotate long-running Jobs with karpenter.sh/do-not-disrupt: "true" rather than freezing a whole NodePool.
Set expireAfter (for patching and compliance) and terminationGracePeriod (so a stuck PDB can't block a node forever). Know that the TGP overrides PDBs.