You run EKS and the Cluster Autoscaler is your current node-scaling story — it works, but it requires you to pre-define every instance shape via Auto Scaling Groups, it scales slowly because ASG terminates one node at a time, and Spot diversification needs careful AZ pinning. Karpenter replaces all of that. It watches unschedulable pods, picks the cheapest instance shape that satisfies the constraints, launches it directly via the EC2 Fleet API, and consolidates aggressively when nodes are underused. This article is the install + initial NodePool we put on real EKS clusters.
How to verify
The Karpenter controllers should be running:
kubectl -n karpenter get pods
helm list -n karpenter
NodePool and EC2NodeClass should be configured:
kubectl get nodepool
kubectl get ec2nodeclass
Karpenter-managed nodes carry a specific label:
kubectl get nodes -l karpenter.sh/registered=true
kubectl get nodes -L karpenter.sh/nodepool
A new node provisioning should be observable in events:
kubectl get events -n karpenter --sort-by=.lastTimestamp | tail -20
What’s happening
Karpenter is two CRDs and a controller. NodePool is the desired shape: which workloads it should serve (via taints and labels), constraints on instance types (architecture, capacity-type, generation), disruption budgets, and the consolidation policy. EC2NodeClass is the cloud-specific bits: which subnet, which security group, which AMI family, which IAM role, the user data, the storage spec. When a Pod is unschedulable, the controller computes the cheapest qualifying instance, talks to EC2 Fleet to launch it, registers the node, taints clear, and Pod schedules.
The contrast with Cluster Autoscaler is meaningful. CA needs an ASG per instance type per AZ — you end up with dozens of ASGs to cover diversity. Karpenter has zero ASGs; one NodePool can mix m6i.large, m6a.xlarge, c6i.2xlarge, etc., picking dynamically. CA scales in by terminating idle nodes one at a time; Karpenter actively replaces a 16xlarge with a 4xlarge if the workload now fits. The trade is that Karpenter holds more state — if the controller breaks, your scale-up stops cold.
The procedure
-
Prep IAM and tag the existing VPC subnets and SGs. Karpenter discovers subnets and security groups via tags. On the relevant subnets:
aws ec2 create-tags \ --resources subnet-aaa subnet-bbb subnet-ccc \ --tags Key=karpenter.sh/discovery,Value=my-cluster aws ec2 create-tags \ --resources sg-eks-nodes \ --tags Key=karpenter.sh/discovery,Value=my-clusterThen create the IAM role Karpenter assumes (one for the controller, one for the nodes) — the upstream
karpentergetting-started CloudFormation or Terraform module does this cleanly. -
Install via Helm.
helm registry login --username AWS \ --password $(aws ecr-public get-login-password --region us-east-1) \ public.ecr.aws helm upgrade --install karpenter oci://public.ecr.aws/karpenter/karpenter \ --version 1.1.0 \ --namespace karpenter \ --create-namespace \ --set "settings.clusterName=my-cluster" \ --set "settings.interruptionQueue=my-cluster-karpenter-interruption" \ --set "serviceAccount.annotations.eks\.amazonaws\.com/role-arn=arn:aws:iam::123456789012:role/karpenter-controller" \ --set "controller.resources.requests.cpu=1" \ --set "controller.resources.requests.memory=1Gi" \ --set "controller.resources.limits.memory=1Gi" -
Define an EC2NodeClass. This declares the cloud-side template:
apiVersion: karpenter.k8s.aws/v1 kind: EC2NodeClass metadata: name: default spec: amiFamily: AL2023 role: KarpenterNodeRole-my-cluster subnetSelectorTerms: - tags: { karpenter.sh/discovery: my-cluster } securityGroupSelectorTerms: - tags: { karpenter.sh/discovery: my-cluster } blockDeviceMappings: - deviceName: /dev/xvda ebs: volumeSize: 100Gi volumeType: gp3 encrypted: true -
Define a NodePool. This is the policy that NodePools and pods share:
apiVersion: karpenter.sh/v1 kind: NodePool metadata: name: default spec: template: metadata: labels: { node-role.kubernetes.io/worker: 'true' } spec: nodeClassRef: group: karpenter.k8s.aws kind: EC2NodeClass name: default requirements: - key: kubernetes.io/arch operator: In values: [amd64] - key: karpenter.k8s.aws/instance-category operator: In values: [c, m, r] - key: karpenter.k8s.aws/instance-generation operator: Gt values: ['5'] - key: karpenter.sh/capacity-type operator: In values: [spot, on-demand] expireAfter: 720h disruption: consolidationPolicy: WhenEmptyOrUnderutilized consolidateAfter: 30s budgets: - nodes: '10%' limits: cpu: 1000 memory: 1000Gi -
Test by deploying an unschedulable workload.
kubectl create deployment inflate --image=public.ecr.aws/eks-distro/kubernetes/pause:3.7 kubectl scale deployment inflate --replicas=20 kubectl get nodes -L karpenter.sh/nodepool -wYou should see new nodes appear within 60 seconds. Scale back to zero and watch Karpenter consolidate them away.
-
Plan Spot interruption handling. Karpenter listens to EC2 Spot Interruption Notices via an SQS queue and pre-emptively drains the node. Make sure
settings.interruptionQueueis set and the queue is wired (CloudFormation/Terraform module does it). Without it, Spot terminations are unreported and workloads are killed mid-flight.
Operational notes
consolidateAfter: 0sis aggressive. It moves pods almost continuously, which is fine for stateless services and disastrous for stateful ones. Use30sto5mdepending on workload tolerance.- PDBs gate disruption. A PodDisruptionBudget with
minAvailable: 100%blocks consolidation. Karpenter will not violate PDBs, but it will accumulate nodes that can’t be drained. Audit PDBs before turning on aggressive consolidation. - Spot diversification depends on instance-category breadth. A NodePool restricted to
c6i.largeonly will hit Spot capacity issues. Keep instance categories broad (c,m,r) and architecture/family open. - Karpenter and Cluster Autoscaler should not co-exist on the same nodes. If you migrate from CA, taint the CA-managed ASG nodes so Karpenter doesn’t pick them, then drain and remove the ASG once Karpenter holds the workload.
- AMI updates are NOT automatic. Karpenter pins the AMI ID it selected on first launch into the NodeClaim. To roll AMIs, edit the EC2NodeClass to bump
amiSelectorTerms(e.g. by tag or alias), and Karpenter replaces nodes per the disruption budget.
Stack Harbor sets up Karpenter on EKS clusters during onboarding — VPC tagging, IAM, NodePool diversity tuned to the actual workload mix, Spot interruption wiring, and the consolidation cadence calibrated to the team’s tolerance. See how we deliver that within our AWS management practice.