What is Karpenter — Explained for Beginners
Karpenter is replacing Cluster Autoscaler in most EKS deployments. Here's what it actually does, how it's different from Cluster Autoscaler, and when to use it.
You've heard Karpenter mentioned as the "new way" to autoscale Kubernetes nodes. But what does it actually do, and why is it better than Cluster Autoscaler?
The Problem: Node Autoscaling
Your Kubernetes cluster has 5 nodes. A deployment scales up from 3 pods to 50 pods. The existing nodes are full. New pods are Pending.
Something needs to add more nodes. That "something" is the node autoscaler.
Cluster Autoscaler — The Old Way
Cluster Autoscaler watches for pending pods and scales up the node group (AWS Auto Scaling Group) when needed.
How it works:
- Pod goes Pending (not enough resources)
- Cluster Autoscaler notices
- CA checks which node group to scale up
- CA calls AWS API to increase ASG desired count
- New EC2 instance starts (~3-4 minutes)
- Instance joins cluster, kubelet runs
- Pod gets scheduled (~4-5 minutes total)
Limitations:
- Tied to pre-configured node groups (you decide instance types upfront)
- Can't mix instance types dynamically
- Slow at recognizing over-provisioning
- Configuration is complex for mixed workloads
Karpenter — The New Way
Karpenter watches for pending pods and launches the OPTIMAL EC2 instance directly — no node groups needed.
How it works:
- Pod goes Pending
- Karpenter sees the pod's requirements (CPU, memory, GPU, spot/on-demand)
- Karpenter calculates the optimal instance type for that exact workload
- Karpenter calls EC2
RunInstancesAPI directly (faster than ASG) - Instance joins cluster, pod gets scheduled (~2 minutes total)
The Key Difference: Direct Instance Provisioning
Cluster Autoscaler path:
Pod Pending → CA → ASG (pre-configured) → EC2 (pre-defined type)
Karpenter path:
Pod Pending → Karpenter → EC2 (optimal type, chosen at runtime)
Karpenter decides "this pod needs 4 vCPU and 16GB RAM — I'll launch a c5.xlarge OR m5.xlarge, whichever is cheapest right now."
NodePool and NodeClass: How Karpenter is Configured
# NodePool: constraints on what Karpenter can provision
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: default
spec:
template:
spec:
requirements:
# Allow these instance families
- key: karpenter.k8s.aws/instance-family
operator: In
values: [c5, m5, r5, c5a, m5a]
# Both spot and on-demand
- key: karpenter.sh/capacity-type
operator: In
values: [spot, on-demand]
# Only Linux
- key: kubernetes.io/os
operator: In
values: [linux]
nodeClassRef:
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
name: default
# Cost optimization: consolidate nodes when possible
disruption:
consolidationPolicy: WhenUnderutilized
consolidateAfter: 30s
# Max cluster size
limits:
cpu: 1000
memory: 1000Gi
---
# EC2NodeClass: AWS-specific config
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata:
name: default
spec:
amiSelectorTerms:
- alias: al2023@latest # Amazon Linux 2023
subnetSelectorTerms:
- tags:
karpenter.sh/discovery: my-cluster
securityGroupSelectorTerms:
- tags:
karpenter.sh/discovery: my-cluster
role: KarpenterNodeRoleSpot Instance Optimization
Karpenter's biggest advantage: intelligent spot instance handling.
# Karpenter automatically:
# 1. Picks cheapest spot instance type that fits the pod
# 2. Watches for spot interruption notices
# 3. Cordons and drains the node before termination (2-minute warning)
# 4. Launches replacement immediately
# You just annotate your deployment:
spec:
template:
spec:
nodeSelector:
karpenter.sh/capacity-type: spotNo ASG configuration, no multiple node groups, no manual spot fleet management.
Consolidation: Scale Down Automatically
Karpenter doesn't just scale up — it consolidates underutilized nodes:
disruption:
consolidationPolicy: WhenUnderutilized
consolidateAfter: 30s # Wait 30s after underutilization detectedIf a node has pods that fit on existing nodes, Karpenter:
- Marks the node for consolidation
- Drains pods gracefully to other nodes
- Terminates the EC2 instance
This saves money automatically without cron jobs.
Install Karpenter on EKS
# Prerequisites: EKS cluster, Helm
# Create IAM role for Karpenter
export CLUSTER_NAME=my-eks-cluster
export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
export KARPENTER_NAMESPACE=kube-system
export KARPENTER_VERSION=1.0.0
# Install via Helm
helm registry logout public.ecr.aws
helm upgrade --install karpenter oci://public.ecr.aws/karpenter/karpenter \
--version "${KARPENTER_VERSION}" \
--namespace "${KARPENTER_NAMESPACE}" --create-namespace \
--set "settings.clusterName=${CLUSTER_NAME}" \
--set "settings.interruptionQueue=${CLUSTER_NAME}" \
--set controller.resources.requests.cpu=1 \
--set controller.resources.requests.memory=1GiKarpenter vs Cluster Autoscaler
| Feature | Karpenter | Cluster Autoscaler |
|---|---|---|
| Provisioning speed | ~2 min | ~4-5 min |
| Instance flexibility | Any instance type | Pre-configured groups |
| Spot optimization | Built-in | Manual configuration |
| Consolidation | Automatic | Basic |
| Configuration complexity | Low | High (many node groups) |
| Cloud support | AWS, Azure (beta) | All clouds |
For new EKS deployments in 2026, Karpenter is the default choice. Cluster Autoscaler is still fine if you need multi-cloud support (Karpenter is primarily AWS-focused) or have existing node group configurations you don't want to change.
Learn Kubernetes autoscaling and cluster management with hands-on EKS labs at KodeKloud.
Today I Fixed
Short real fixes from production — posted daily
Stay ahead of the curve
Get the latest DevOps, Kubernetes, AWS, and AI/ML guides delivered straight to your inbox. No spam — just practical engineering content.
Related Articles
AWS EKS Cluster Autoscaler Not Scaling — Every Fix (2026)
Your EKS Cluster Autoscaler isn't scaling up, scale-down isn't working, or nodes spin up but stay empty. Here's every cause and the exact fix.
AWS EKS Pods Stuck in Pending State: Causes and Fixes
Pods stuck in Pending on EKS are caused by a handful of known issues — insufficient node capacity, taint mismatches, PVC problems, and more. Here's how to diagnose and fix each one.
AWS EKS vs Google GKE vs Azure AKS — Which Managed Kubernetes to Use in 2026?
Honest comparison of EKS, GKE, and AKS in 2026: pricing, developer experience, networking, autoscaling, and which one to pick for your use case.