AWS - Karpenter - Kubernetes cluster auto-scaler

AWS - Karpenter - Kubernetes cluster auto-scaler

AWS recently announced Karpenter – An Open-Source High-Performance Kubernetes Cluster Autoscaler - ReInvent-2021

Before getting into the discussion of Karpenter, let's discuss k8s native cluster auto-scaler.

According to the documentation below is the definition:

Cluster Autoscaler is a tool that automatically adjusts the size of the Kubernetes cluster when one of the following conditions is true:

  • there are pods that failed to run in the cluster due to insufficient resources.
  • there are nodes in the cluster that have been underutilized for an extended period of time and their pods can be placed on other existing nodes.

And if we prefer to adjust the CA for various use cases we have to create each group for them, as explained below.

Traditional way:

Creating autoscaling groups different types of node groups based on our needs.


ASG node group for GPU use ASG node group for general use and based on instance family etc..

This creates more overhead in maintenance and operation costs. :(

Why do we need a cloud-native cluster auto-scaler?

Cloud-native CA (cluster-autoscaler) explores the full capability of the native tools and technologies which helps to effectively and efficiently use the resources in all aspects.

This creates a debate about Kubernetes native vs AWS native.


Karpenter solves the following problem making effective decisions and scheduling.

What does the pod need? Where is the pod best fit-in? What can I do to best fit that pod in a node?

it provides complete control over ec2 instances

cat <<EOF |kubectl apply -f -apiVersion:
 kind: Provisioner
 name: default
 #Requirements that constrain the parameters of provisioned nodes. 
 #Operators { In, NotIn } are supported to enable including or excluding values
     - key: #If not included, all instance types are considered
       operator: In
       values: ["m5.large", "m5.2xlarge"]
     - key: "" #If not included, all zones are considered
       operator: In
       values: ["us-east-1a", "us-east-1b"]
     - key: "" #If not included, all architectures are considered
       values: ["arm64", "amd64"]
     - key: "" #If not included, the webhook for the AWS cloud provider will default to on-demand
       operator: In
       values: ["spot", "on-demand"]
     instanceProfile: KarpenterNodeInstanceProfile-eks-karpenter-demo
   ttlSecondsAfterEmpty: 30  


From the above provisioner config file, we can see we can control instance type, Availability zone, architecture and capacity type (on-demand vs Spot)


  • Faster Scheduling - Karpenter directly manages the nodes.

  • No Node group provisioning - Karpenter takes care of instance provisioning with node groups, it can schedule pods in instances based on the configuration.

  • Cost-effective than k8s native cluster auto-scaler.

Karpenter: Right now it only supports AWS native, anyone can contribute to other cloud tools.

Wonderfull self-explained video from JustinGarrison about Karpenter

--- End-of-Blog ---


Did you find this article valuable?

Support Jothimani Radhakrishnan by becoming a sponsor. Any amount is appreciated!