Introduction
Every pod in Kubernetes needs a node. On EKS, unless the pod runs on Fargate, that node is an EC2 instance that someone, or something, decided to launch. For years that decision ran through Auto Scaling Groups: a fixed list of instance types per group, Cluster Autoscaler nudging the group's desired capacity, and a lot of Terraform to keep the groups in shape.
Karpenter changed that model. It skips node groups entirely and launches the instance that fits the pods waiting to run, then keeps reshaping the fleet as those pods come and go. Karpenter is open source, and it is also the engine behind EKS Auto Mode.
This article walks through how node provisioning worked before Karpenter, where that model broke down, and what Karpenter does differently.
Why node provisioning matters
- It decides how fast pods start: a pod that cannot be scheduled waits until a node with room for it exists. Slow provisioning turns a traffic spike into queued requests.
- It decides most of the bill: on most EKS clusters, compute is the largest line item. Idle capacity and poorly sized instances are paid for every hour they run.
- It decides how disruptive maintenance is: AMI updates, Kubernetes upgrades and Spot interruptions all replace nodes. How nodes are replaced decides whether workloads notice.
Before Karpenter: node groups
Before Karpenter, EKS gave you three ways to run pods: self-managed node groups, managed node groups and Fargate. The first two are both built on EC2 Auto Scaling Groups, and that shared foundation is where most of the limitations come from.
Self-managed node groups
A self-managed node group is an ASG you build and own. You write the launch template, pick the EKS-optimized AMI, pass the bootstrap script the cluster name and endpoint, and map the node's IAM role into the cluster so the kubelet can join.
- Full control: any AMI, any user data, any instance type the ASG supports.
- Full responsibility: EKS does not know these nodes belong to a group. An AMI update means a new launch template version and an ASG instance refresh, and draining the old nodes safely is your problem, not AWS's.
- Lifecycle hooks are on you: to drain a node before the ASG terminates it, you wire up lifecycle hooks, an EventBridge rule and something like the AWS Node Termination Handler.
EKS managed node groups
Managed node groups (MNGs) arrived in late 2019 to take that undifferentiated work away. Under the hood, a managed node group is still an EC2 Auto Scaling group in your account, but EKS creates it and manages it for you: it owns the launch template defaults, joins the nodes, and knows how to update them.
An MNG version update runs in four phases: setup, scale up, upgrade and scale down. EKS points the ASG at a new launch template version, then scales the group up by the larger of maxUnavailable and up to twice the number of Availability Zones the group spans. It cordons and drains old nodes up to maxUnavailable at a time, waits 60 seconds after eviction, and terminates them. If pods do not leave a node within 15 minutes, the update fails with PodEvictionFailure unless you set the force flag.
This was a real improvement. But an MNG is still an ASG underneath, with one launch template, a fixed list of instance types and a desired capacity that something else has to change.
Fargate
Fargate removed nodes from the picture: each pod runs in its own isolated micro-VM, sized from the pod's requests. That suits small, isolated workloads, but every pod pays for its own VM. There are no DaemonSets, no GPUs and no privileged containers, so it never became a general answer for a cluster's main workloads.
How Cluster Autoscaler worked with node groups
Node groups do not scale themselves. On EKS the job fell to Cluster Autoscaler (CA), the upstream Kubernetes autoscaler, running as a Deployment in the cluster. CA does not launch instances. It only changes the desired capacity of ASGs it is allowed to manage, and the ASG does the rest.
The scale-up loop
- Find pending pods: every 10 seconds by default, CA looks for pods the scheduler marked unschedulable.
- Simulate each node group: for every ASG, CA builds a template node and simulates whether the pending pods would fit on a new node from that group.
- Pick a group: if several groups would help, an expander chooses one. The default is
random; others includeleast-waste,most-pods,least-nodesandpriority. - Bump the ASG: CA raises that ASG's desired capacity. The ASG launches an instance from its launch template, the node bootstraps and joins, and the scheduler finally places the pod.
Scale-down runs on the same loop. A node becomes a candidate when its pods' requests fall below 50% of its allocatable CPU and memory, and it is removed only after it has been unneeded for 10 minutes and its pods fit elsewhere.
The assumption underneath
CA's whole model rests on one assumption, stated plainly in its FAQ: every machine in a node group has identical capacity and the same labels. The template node is a stand-in for every node the group could ever produce.
That assumption shaped how everyone built clusters:
- Mixed instance types had to match: an ASG with a mixed instances policy could list several instance types, but CA expects them to have the same CPU and memory. When overrides exist, CA sizes the template from the first instance type only.
- Scaling from zero needed tags: an empty ASG has no node to copy, so CA reads labels, taints and resources from
k8s.io/cluster-autoscaler/node-template/...tags on the ASG. A missing taint tag could launch a node the pending pod could not use. - Discovery needed tags too: CA only manages ASGs that carry the auto-discovery tags. An untagged group is invisible to it.
The limitations of the node-group model
None of these problems came from a bug. They came from the shape of the model: Kubernetes knows what each pod needs, but the decision about which instance to launch was made ahead of time, by a human, in a launch template.
Node group sprawl
Because a group can only produce one shape of node, every new requirement meant a new group. A typical cluster ended up with groups per instance family, per architecture (x86 and Graviton), per capacity type (On-Demand and Spot), per Availability Zone for zonal storage, and per team that needed a taint. Each group was another launch template, another set of CA tags and another thing to refresh during an upgrade.
Instance choice frozen in Terraform
The instance types a workload could land on were whatever someone wrote into the node group months earlier. New, cheaper instance generations went unused until someone edited the group and rolled it.
The problem was not that an ASG could hold only one instance type. With a mixed instances policy, an ASG can list up to 40 instance types, from different series (such as c, m and r) and even across x86 and Graviton. The problem was that nothing chose among those types based on the pods:
- The ASG chooses by price and capacity, not by pods. When asked for one more instance, it picks from its list using its allocation strategy and never looks at the pod that is waiting. A pod that needs 30 GiB of memory can get a
c5.xlargewith 8 GiB because that was the cheapest type available, and stay pending. - Cluster Autoscaler can only plan with one shape per group. It sizes its template node from a single instance type in the group. If a group mixes sizes, CA cannot predict which one the ASG will launch, so the guidance was to keep every type in a group at the same vCPU and memory, and to create another group for every other shape.
So the flexibility existed in the ASG, but neither the ASG nor the autoscaler in front of it could use it to fit the workload. In practice, a pod requesting 14 GiB of memory landed on a 32 GiB node simply because that was the group that fit. Karpenter makes the opposite choice: it starts from the pods and picks the instance type to match.
Bin packing was approximate
CA picks a group, not an instance. With matching instance types per group, the expander chooses among a handful of pre-built shapes, so the result is the best available group rather than the best-fitting instance. Leftover headroom on every node added up across a fleet.
Scaling went through two control loops
CA decides, the ASG acts, and the two are only loosely coupled. CA writes a desired capacity and waits; the ASG launches on its own schedule; CA learns the outcome by watching nodes register, with up to 15 minutes allowed before it gives up on a node. When a Spot pool or instance type had no capacity, the failure surfaced late and indirectly, and CA had to back off that group before trying another.
Scale-down was conservative
CA removes nodes one candidate at a time, and only when one is under the utilization threshold and its pods fit elsewhere. It does not ask whether three half-empty nodes could be replaced by one smaller, cheaper node. Clusters tended to drift into fragmentation after every traffic peak.
Node upgrades were a separate workflow
Scaling and lifecycle were different tools. CA scaled; MNG updates or ASG instance refreshes replaced nodes for new AMIs; the Node Termination Handler handled Spot interruptions. Each had its own pacing and its own idea of when a node was safe to remove, and they did not coordinate with each other.
What Karpenter does differently
Karpenter turns the old model around. Instead of choosing a node group and hoping its instances fit, it looks at the pods that are waiting and launches the instance that fits them. There are no ASGs, no launch templates to maintain per group and no desired capacity in between.
instance types fixed in the launch template
computed from the pods themselves
Both paths start with the same pending pod. Cluster Autoscaler can only choose among groups whose instance types were fixed ahead of time; Karpenter computes the instance types from the pods themselves and launches directly.
Groupless provisioning
- Watch for pending pods: Karpenter watches for pods the scheduler cannot place.
- Batch them: it waits until no new pending pods arrive for 1 second, or 10 seconds at most, so a burst of replicas is solved as one problem rather than one node per pod.
- Solve for requirements: it combines each pod's requests with its node selectors, affinities, tolerations and topology spread constraints, then intersects them with what the NodePool allows. The result is a set of instance types that would all work.
- Launch directly: Karpenter calls the EC2 Fleet API with that whole set of instance types and Availability Zones, and lets EC2 choose from the pools that have capacity. On-Demand favours the lowest price; Spot uses price-capacity-optimized allocation.
- Track the launch: Karpenter records each launch as a NodeClaim and remembers which pending pods it is for, so it does not launch more capacity for them while the node boots. The scheduler places them once the node is ready.
Because the instance list is computed per batch, a pod asking for 14 GiB lands on something close to 14 GiB, and a burst of 200 small pods lands on a few large instances. A failed launch in one pool is just another pool to skip in the same Fleet request, not a whole node group to back off from.
Why Karpenter scales faster
The speed comes from removing steps between a pending pod and a running instance, not from EC2 booting any faster.
- One controller instead of two systems: Cluster Autoscaler writes a desired capacity and waits for the ASG to act on it. Karpenter records its decision as a NodeClaim in the Kubernetes API, and its own controller turns that NodeClaim into an EC2 launch request straight away. There is no ASG in between, and Karpenter knows the outcome of the launch as soon as EC2 returns it.
- Capacity errors cost seconds, not minutes: a single EC2 Fleet request lists many instance types across several Availability Zones, so a pool with no capacity is simply skipped. With node groups, a group that could not launch had to be backed off before Cluster Autoscaler tried another.
- Bursts are solved at once: batching turns a scale-out of many replicas into one provisioning decision and a few right-sized nodes, rather than a node at a time as each simulation round completes.
- No duplicate launches while nodes boot: Karpenter tracks which pending pods each in-flight NodeClaim is meant for, so the next batch does not launch more capacity for the same pods. The scheduler places them as soon as the node is ready.
- No template guesswork: Karpenter knows each instance type's real capacity, so it does not launch a node from a mis-tagged or mis-sized group that turns out not to fit the pod.
Two objects instead of many groups
Configuration is split into what a node may be and how it is built.
- NodePool: the constraints. Which instance categories, families, sizes, architectures, zones and capacity types are allowed; which taints and labels nodes carry; resource limits for the pool; and the disruption policy.
- EC2NodeClass: the AWS details. The node IAM role, the subnets and security groups (found by tag), the AMI, block devices and user data.
A single NodePool replaces what used to be a dozen node groups:
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: default
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
limits:
cpu: 1000
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 1m
budgets:
- nodes: 10%
---
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata:
name: default
spec:
role: KarpenterNodeRole-my-cluster
subnetSelectorTerms:
- tags:
karpenter.sh/discovery: my-cluster
securityGroupSelectorTerms:
- tags:
karpenter.sh/discovery: my-cluster
amiSelectorTerms:
- alias: al2023@v20240807
This pool allows compute, general purpose and memory-optimized families from generation 6 onward, on both x86 and Graviton, Spot or On-Demand. Karpenter picks among hundreds of instance types for each batch, and a workload narrows that further with an ordinary node selector, such as karpenter.sh/capacity-type: on-demand.
Side by side
| Cluster Autoscaler + node groups | Karpenter | |
|---|---|---|
| Unit of scaling | A node group (ASG) | A single instance (NodeClaim) |
| Instance choice | Fixed in each launch template | Computed per batch from pod requirements |
| How it launches | Raises ASG desired capacity | Calls the EC2 Fleet API directly |
| Capacity errors | Back off the group, try another | Skip the pool within the same request |
| Scale-down | One under-used node at a time | Consolidation: delete or replace with cheaper nodes |
| AMI and config changes | MNG update or ASG instance refresh | Drift: replaced automatically, under budgets |
| Spot interruptions | Separate Node Termination Handler | Built in, via an SQS interruption queue |
| Configuration | Many groups, many tags | A few NodePools and EC2NodeClasses |
Consolidation, drift and disruption budgets
Launching the right node is half of Karpenter. The other half is that it keeps managing the node after launch: it removes nodes that are no longer needed, replaces nodes that no longer match their configuration, and paces all of it with budgets. With node groups, these were three separate tools.
Graceful and forceful disruption
Karpenter sorts every reason to remove a node into two kinds:
- Graceful: consolidation, drift and node auto repair. These are rate-limited by disruption budgets, and Karpenter launches any replacement and waits for it to be ready before draining the old node.
- Forceful: expiration and interruption. These start draining immediately, without waiting for a replacement, and budgets do not limit them. PodDisruptionBudgets still apply to the pods being evicted.
Consolidation
Consolidation is the answer to CA's conservative scale-down. Karpenter tries three things, in this order:
- Empty nodes: delete every empty node, in parallel.
- Multi-node: delete two or more nodes together, possibly launching one cheaper node to take their pods.
- Single-node: delete one node, possibly replacing it with one cheaper node.
A node is replaced only when its pods fit on the free capacity of other nodes plus one lower-priced node. So three half-empty m6i.2xlarge nodes can become one m6i.4xlarge, or a large node left behind after a peak can shrink to a smaller one. The policy is set per NodePool: WhenEmpty only removes empty nodes, WhenEmptyOrUnderutilized does all three, and consolidateAfter sets how long a node must be stable before it becomes a candidate.
For Spot, deleting nodes is on by default. Replacing one Spot node with a cheaper Spot node sits behind the SpotToSpotConsolidation feature gate, and the single-node version needs at least 15 instance type options so Karpenter does not chase the cheapest, most interruptible pool.
Drift
Drift replaces the MNG update and the ASG instance refresh. A NodeClaim is drifted when it no longer matches its NodePool or EC2NodeClass: a change to the NodePool's requirements, or to the EC2NodeClass's subnets, security groups or AMI selector. Behavioral fields such as limits, weight and disruption do not cause drift.
The AMI is the case that matters most. With amiSelectorTerms set to al2023@latest, every new EKS AMI release drifts every node, so the Karpenter docs recommend pinning a version such as al2023@v20240807 in production and promoting it through lower environments first. Upgrading nodes becomes a one-line change to the EC2NodeClass.
Expiration and interruption
- Expiration:
expireAfteron the NodePool sets the maximum lifetime of a node, 720 hours (30 days) by default. Once a node is older, Karpenter drains it immediately. Paired withterminationGracePeriod, the maximum time a drain may take before remaining pods are force-deleted, it puts an absolute ceiling on node age. - Interruption: given an SQS queue fed by EventBridge rules, Karpenter taints and drains nodes ahead of Spot interruption warnings, scheduled maintenance and instance stop or terminate events, and starts a replacement as soon as a Spot warning arrives. This replaces the Node Termination Handler.
Disruption budgets
Budgets set how many of a NodePool's nodes may be voluntarily disrupted at once. Each budget has a nodes value (a count or a percentage, rounded up), and can be limited to certain reasons (Drifted, Underutilized, Empty, Unhealthy) or to a time window with a cron schedule and a duration. When several budgets apply, the most restrictive wins. With no budgets set, the default is nodes: 10%.
That is how a maintenance window works. Because the most restrictive active budget wins, a window is written as a block that is active for the rest of the week. These budgets allow drift and consolidation only from 02:00 to 06:00 UTC on Wednesdays, while empty nodes can go at any time:
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: 5m
budgets:
# Up to 20% of nodes at once, but only when the block below is inactive
- nodes: "20%"
reasons: ["Drifted", "Underutilized"]
# Block from Wednesday 06:00 UTC for 164h, until the next Wednesday 02:00
- nodes: "0"
reasons: ["Drifted", "Underutilized"]
schedule: "0 6 * * wed"
duration: 164h
# Empty nodes can always be removed
- nodes: "100%"
reasons: ["Empty"]
One caution: a budget window applies to the whole NodePool and knows nothing about other node changes. If it opens on the same day as a refresh of another node group, two sets of nodes change at once, and the real cause of an incident can hide behind the more obvious change.
Protecting individual pods
The karpenter.sh/do-not-disrupt: "true" annotation on a pod stops Karpenter from consolidating or drifting the node it runs on; a duration such as "30m" protects it only for that long after it starts. It suits batch jobs and long-running builds. It does not stop expiration, interruption or a manual delete, and a NodeClaim's terminationGracePeriod lets drift proceed past it.
Running Karpenter alongside a static node group
Karpenter can replace most of a cluster's node groups, but it should not replace all of them. A common, deliberate pattern is to keep one small, static node group next to it.
The bootstrap problem
Karpenter is a pod. It cannot launch the node it needs to run on, and it should not run on a node it might decide to consolidate. The same goes for the components every other node depends on. A few scenarios show what goes wrong when they run on Karpenter nodes:
- Every Karpenter node is lost at once: a wave of Spot interruptions in one pool, a zone outage, or a NodePool scaled to zero removes the nodes the Karpenter controller was running on. Its pods go pending, and the only component that could launch a node for them is one of those pending pods. The cluster cannot recover until someone adds capacity by hand.
- Karpenter consolidates its own node: the node running the controller is underutilized, so Karpenter drains it. The controller is evicted partway through the disruption it started, and until a replica is running again, nothing provisions capacity for pending pods.
- CoreDNS moves while Karpenter needs it: consolidation or drift evicts CoreDNS replicas while applications are resolving names, and lookups fail during the move. Karpenter itself resolves the EC2, SQS and pricing API endpoints through cluster DNS by default, so if CoreDNS is down and needs a new node, Karpenter may not be able to reach EC2 to launch one.
- The load balancer controller is mid-eviction during a rollout: in IP target mode, the AWS Load Balancer Controller registers pod IPs with target groups. If it is being rescheduled while consolidation moves application pods, new pods are not registered and old IPs stay in the target group, so the load balancer sends traffic to pods that no longer exist.
Keeping these components on nodes Karpenter does not manage breaks every one of these loops: they stay up while Karpenter reshapes the rest of the cluster.
The usual split is two kinds of nodes:
- Static nodes: a small node group, self-managed or managed, for the components that must be running before Karpenter can create anything: the Karpenter controller itself, CoreDNS, and controllers such as the AWS Load Balancer Controller and the Amazon EBS CSI driver. These are pinned to the static group and never run on Karpenter nodes.
- Karpenter nodes: everything else. Application workloads land on nodes Karpenter launches from its NodePools, sized to whatever is pending.
The static group is small and rarely changes, so it costs little to keep. Everything that scales with traffic runs on Karpenter nodes.
What a self-managed install needs
Running Karpenter yourself, rather than through EKS Auto Mode, means owning the pieces around the controller:
- IAM: a controller role (through IRSA or EKS Pod Identity) that can call EC2 Fleet, describe instances and pricing, and pass the node role, plus the node role itself with access to join the cluster.
- Discovery tags:
karpenter.sh/discoverytags on the subnets and security groups the EC2NodeClass selects. - Interruption queue: an SQS queue with EventBridge rules for Spot interruptions, scheduled maintenance and instance state-change events, passed to the controller as its interruption queue. Without it, interruption handling is off.
- Upgrades: Karpenter's CRDs and controller move together, and each release supports a range of Kubernetes versions, so a cluster upgrade starts by checking the compatibility matrix.
Refreshing both kinds of nodes
Both kinds of nodes need regular replacement for new AMIs, and different mechanisms replace them. The static group is refreshed through a managed node group update or an ASG instance refresh; the Karpenter nodes are replaced through drift, under the NodePool's disruption budget.
Trade-offs and things to watch
Karpenter removes a lot of work, but it moves some responsibility onto the workloads. A node group was static enough to hide sloppy pod specs; Karpenter acts on exactly what the pods say.
- Requests are the whole input: Karpenter sizes nodes from pod requests, not from actual usage. Requests set far too low pack pods onto nodes that then run hot; requests set far too high buy instances nobody uses.
- Consolidation means more pod movement: a cluster that consolidates is a cluster where pods are evicted regularly. Every workload needs a PodDisruptionBudget, more than one replica, topology spread across zones, and graceful shutdown handling.
consolidateAfterand budgets are the controls when it is too eager. - Wide instance choice cuts both ways: more instance types mean better prices and fewer capacity errors, but also more variety in CPU generation, network bandwidth and local storage. Workloads that are sensitive to these should narrow their own requirements rather than the whole NodePool.
- Set NodePool limits:
limitson CPU and memory are the guard against a runaway Deployment or a bad HPA target launching hundreds of nodes. - Pin AMIs and promote them: with a pinned alias, an AMI change is a reviewed change to the EC2NodeClass that rolls out under the budget, environment by environment.
- Karpenter needs its own care: run at least two controller replicas, keep them off Karpenter nodes, and keep the controller version within the range supported by each Kubernetes version.
Self-managed Karpenter or EKS Auto Mode
EKS Auto Mode runs Karpenter for you, outside the cluster, along with core add-ons and the node AMIs. It suits teams that want the provisioning model without the upgrade and IAM work, at the cost of a per-instance management fee and less control over the controller, its feature gates and the AMI. Teams that already run the controller, a static node group and the infrastructure code around them often stay self-managed; teams starting fresh may find Auto Mode the quicker path.
Summary
- Node groups fixed the shape of a node before the pod existed. Every ASG produced one kind of instance, and Cluster Autoscaler could only choose among those groups. Sprawl, approximate bin packing and stale instance choices all follow from that.
- Karpenter decides per batch of pending pods. It reads each pod's requests and constraints, computes every instance type that would work, and asks EC2 Fleet for whichever has capacity at the best price.
- Scaling and lifecycle are one controller. Consolidation, drift, expiration and interruption handling replace Cluster Autoscaler's scale-down, MNG updates, ASG instance refreshes and the Node Termination Handler.
- Budgets make disruption predictable. Counts, reasons and scheduled windows decide when nodes may change, and they are the tool for a maintenance day.
- The workloads have to hold up their side. Accurate requests, PodDisruptionBudgets, replicas and topology spread decide whether constant node change is invisible or painful.
- Keep a small, stable base. Karpenter, CoreDNS and the add-ons everything depends on belong on nodes Karpenter does not manage.
Moving from node groups to Karpenter changed the question we ask about capacity. We no longer ask which group a workload should run in; we describe what the workload needs and what a node may be, and let the controller find the instance. That only works when the pods describe themselves honestly.
Sources
- Karpenter: Disruption
- Karpenter: NodeClasses
- Karpenter: Settings
- Amazon EKS: Managed node update behavior
- Cluster Autoscaler FAQ
- Cluster Autoscaler on AWS