โ† Back to Home

๐Ÿš€ Karpenter Core Concepts

Interactive diagrams for Kubernetes node autoscaling: provisioning, disruption budgets, bin-packing and spread

Updated for Karpenter v1 (karpenter.sh/v1, docs v1.15)

What is Karpenter?

๐ŸŽฏ Just-in-Time Node Provisioning

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.

๐Ÿณ Pod
โ†’
โšก Karpenter
โ†’
๐Ÿ–ฅ๏ธ Node

๐Ÿ”„ Continuous Optimization

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).

๐Ÿ–ฅ๏ธ 3 Nodes
โ†’
๐Ÿ–ฅ๏ธ 1 Node

๐Ÿ›ก๏ธ Disruption Budgets

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.

โš™๏ธ Declarative Configuration

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.

๐Ÿ†š Karpenter vs Cluster Autoscaler

AspectCluster AutoscalerKarpenter
Unit of scalingNode groups (ASGs / managed node groups). Each group has one shapeIndividual nodes. Every launch can pick a different instance type
Instance choiceFixed per group. Many shapes means many groupsPicks from all types allowed by the NodePool's requirements, sized for the pending pods
SpeedChanges the ASG's desired count, then waits for the ASG to launchCalls the EC2 Fleet API directly
Scale-downRemoves nodes below a utilization thresholdConsolidation: deletes nodes or replaces them with cheaper ones
Lifecycle managementOutside its scopeDrift, expiration, interruption handling and (alpha) node repair

Core Components

๐Ÿ—๏ธ Karpenter Architecture

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.

๐Ÿ“‹ NodePool

Defines which nodes may exist and how they may be disrupted:

  • requirements: instance category, family, generation, size, architecture, zone, capacity type
  • taints / startupTaints: who may schedule there, and setup that must finish first
  • expireAfter: maximum node lifetime (Never disables it)
  • terminationGracePeriod: maximum time a node may spend draining
  • disruption: consolidation policy and budgets
  • limits: a cap on total CPU, memory or node count
  • weight: priority when several NodePools match a pod
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

๐Ÿ–ฅ๏ธ EC2NodeClass

Defines how to build the instance on AWS:

  • amiSelectorTerms (required): an alias such as al2023@โ€ฆ or bottlerocket@โ€ฆ, or selection by tags, name, ID or SSM parameter
  • subnetSelectorTerms and securityGroupSelectorTerms (required)
  • role (Karpenter manages the instance profile) or instanceProfile
  • Optional: block devices, kubelet settings, user data, tags, metadata options
apiVersion: 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.

๐Ÿงพ NodeClaim

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

๐Ÿง  How Karpenter Picks a Node

  • Batch: waits briefly for more pending pods so they can be planned together. The window closes after 1 s with no new pods, or 10 s at most by default.
  • Simulate: plays out scheduling with each pod's requests (not limits, not actual usage), node selectors, affinities, tolerations, topology spread, and the requests of the DaemonSets that will run on the node.
  • Pick a NodePool: the highest weight whose requirements, taints and limits fit.
  • Pick instance types: every type that fits the batch. Karpenter passes the whole list to EC2 Fleet: lowest-price for on-demand, price-capacity-optimized for spot.
  • Capacity type priority: reserved (capacity reservations) first, then spot, then on-demand.
  • Bind: Karpenter does not place pods. kube-scheduler binds them once the node is ready (see Bin-packing & Spread).

Node Lifecycle

Ready
๐Ÿ“ฆ Unscheduled Pods
๐Ÿณ cpu: 4
๐Ÿณ nvidia.com/gpu: 1
โšก
Karpenter
Controller
Watching...
๐Ÿ”ง Provisioning
๐ŸŸข Active Nodes
๐Ÿ–ฅ๏ธ c5.xlarge
โš ๏ธ Disruption
๐Ÿ’€ Terminated
๐Ÿ“œ Event Log

โฌ†๏ธ Launch Path

  1. Pod is Pending: kube-scheduler can't fit it on any node.
  2. Karpenter batches pending pods and simulates scheduling.
  3. Karpenter creates a NodeClaim, and EC2 Fleet launches an instance (Launched).
  4. The kubelet joins the cluster (Registered).
  5. Startup taints are cleared, and the node reports its resources (Initialized).
  6. kube-scheduler binds the pending pods to the new node.

โฌ‡๏ธ Graceful Disruption Path

  1. The node becomes a candidate: Drifted, Empty or Underutilized.
  2. The NodePool budget is checked, and a scheduling simulation decides whether a replacement is needed.
  3. The node is tainted karpenter.sh/disrupted:NoSchedule.
  4. Replacements are launched first and must become ready (pre-spin).
  5. Pods are drained with the Eviction API, which respects PDBs, and volume attachments are cleaned up.
  6. The instance is terminated and the finalizer removed.

Disruption & Budgets

๐Ÿงญ Disruption Methods: Which Ones Budgets Control

MethodKindTriggered whenBudget reasonLimited by budgets?
Consolidation: emptyGracefulA node has no workload pods (DaemonSets don't count)Emptyโœ… Yes
Consolidation: underutilizedGracefulThe node's pods fit elsewhere, or on one cheaper replacementUnderutilizedโœ… Yes
DriftGracefulThe node no longer matches its NodePool or NodeClass (AMI, requirements, settings)Driftedโœ… Yes
Node auto repair (alpha)GracefulThe node stays unhealthy (e.g. Ready=False) past a toleration periodUnhealthyโœ… Yes
ExpirationForcefulThe node is older than expireAfterโ€”โŒ No: drains immediately
InterruptionForcefulSpot interruption (2-minute warning), scheduled maintenance, or the instance stopping or terminatingโ€”โŒ No
ManualManualkubectl 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.

โ™ป๏ธ Consolidation Policy

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 vs Replace

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.

๐Ÿ”’ Protecting Pods and Nodes

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.

โฑ๏ธ terminationGracePeriod

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.

๐Ÿ“ How Budgets Are Evaluated

1
Fields: nodes (required: a count such as "3" or a percentage such as "20%"), optional reasons, optional schedule + duration, which must be set together.
2
Reasons: Empty, Underutilized, Drifted, Unhealthy. A budget without reasons applies to all of them.
3
Most restrictive wins: for each reason, Karpenter takes the minimum over the active budgets that list that reason or list none. A budget can only lower the limit, never raise it.
4
Schedules are cron expressions (5 fields, or @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.
5
Default: with no budgets defined, you get one budget of nodes: "10%".
6
Counting: allowed = roundup(total ร— pct) โˆ’ deleting โˆ’ notReady. A count works the same way: n โˆ’ deleting โˆ’ notReady. NotReady nodes are not subtracted for Unhealthy.

๐Ÿงฎ Budget arithmetic

๐Ÿ”‘ Node States

โœ“
HealthyRunning normally
!
CandidateDrifted / Empty / Underutilized
โ†ป
ReplacingReplacement ready โ†’ draining
โœ•
GoneTerminated
2

๐ŸŽฌ Disruption Budget in Action

๐Ÿ›ก๏ธ Budget consumed: 0 / 2 nodes

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.

๐Ÿ“ Budget YAML: Read Them Correctly

Reason-specific budgets

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.)

โŒ Doesn't do what it looks like

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.

โœ… "Faster at night", written correctly

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.

๐Ÿ“œ Disruption Log

Budget Recipes for Different Workloads

๐Ÿงฉ Three Questions per NodePool

1. Which reasons are acceptable?Removing empty nodes is almost free. Moving pods off under-used nodes restarts them. Drift is how patches reach your nodes.
2. When?Peak traffic, business hours, change freezes, or maintenance windows. Remember that schedules are in UTC.
3. How fast?A count for small or stateful pools. A percentage for large stateless pools.

Give workloads with different needs separate NodePools (with taints or node selectors), because budgets are set per NodePool.

๐Ÿ—“๏ธ Recipe Explorer

    0 (blocked) limited generous

    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.

    ๐Ÿ“Œ Things Budgets Can't Do

    They don't stop forceful disruption

    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.

    They don't protect individual apps

    A budget of 1 node can still take down every replica if they all sit on that node. Use PDBs plus spread (next tab).

    They can't follow your time zone

    Schedules are UTC-only. Daylight-saving shifts move your window by an hour twice a year, so leave some margin.

    They can't express dates like "Black Friday"

    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.

    Bin-packing & Spread

    ๐Ÿ“ฆ Karpenter Is a Bin-packer

    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).

    ๐ŸŒ Spread Is a Deliberate Cost

    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.

    ๐Ÿงช Placement Simulator

    โš–๏ธ kube-scheduler Decides Where Pods Land

    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.

    LeastAllocated (default)

    MostAllocated (bin-pack)

    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

    ๐Ÿงฐ Spread Patterns

    Zone spread (hard)

    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.

    Node spread (soft)

    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.

    One replica per node (hard)

    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.

    Spot / on-demand ratio

    # 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.

    ๐Ÿ“Š Choosing Between Them

    Concern๐Ÿ“ฆ Bin-pack๐ŸŒ Spread
    CostLowest: fewer, fuller nodesHigher: more nodes, lower utilization
    Node failureCan take out many replicas at onceTakes out โ‰ค 1/N of replicas
    Zone failureMay take out everything if all nodes share a zoneTakes out ~1/3 with 3 zones
    Consolidation churnHigh: nodes empty out and get removed oftenLower, but constraints can block consolidation
    Noisy neighboursMore contention (CPU, memory bandwidth, network)Less contention
    Best forBatch, CI, dev, stateless workers with many replicasCustomer-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.

    Karpenter Disruption Budgets vs Pod Disruption Budgets

    ๐Ÿ” Side-by-Side Comparison

    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

    ๐Ÿ”„ How They Work Together

    1
    Karpenter Budget

    "Would disrupting another node exceed the NodePool's budget for this reason, right now?"

    โ–ผ
    2
    If within budget

    Taint the node karpenter.sh/disrupted โ†’ launch a replacement โ†’ begin draining

    3
    PDB Check

    The Eviction API checks each pod: "Would this violate its PDB?"

    โ–ผ
    4
    Eviction result

    โœ… 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.

    โœ… Best Practices

    ๐Ÿ›ก๏ธ Give every important workload a PDB

    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.

    ๐Ÿ“Š Start from the default

    The implicit nodes: "10%" suits most stateless pools. Small or stateful pools are better with a count ("1"), because percentages round up.

    ๐Ÿ• Loosest limit always on, schedules to tighten

    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.

    ๐Ÿ”’ Freeze with nodes: "0"

    Block Underutilized and Drifted during critical windows, and still allow Empty so idle capacity keeps getting cleaned up.

    ๐Ÿงท Protect jobs, not whole pools

    Annotate long-running Jobs with karpenter.sh/do-not-disrupt: "true" rather than freezing a whole NodePool.

    โณ Bound everything

    Set expireAfter (for patching and compliance) and terminationGracePeriod (so a stuck PDB can't block a node forever). Know that the TGP overrides PDBs.