Why You Might Want to Use Karpenter

29 Jun 2023 - rich

Autoscaling is critical for optimizing the performance and efficiency of your Kubernetes cluster. Usually, and typically, Cluster Autoscaler has been the solution most people choose to manage their clusters. However, you might want to consider AWS Karpenter when setting up and using your EKS clusters within an AWS environment. In some cases, Karpenter offers an even more powerful and flexible alternative to Cluster Autoscaler (CAS).

What Is AWS Karpenter?

AWS Karpenter (Karpenter) is an open-source autoscaling solution that includes many advantages and functionality when you need to manage your Kubernetes nodes. By communicating directly with the AWS EC2 Fleet API, Karpenter simplifies and automates node management. By talking directly to the Fleet API, Karpenter is able to eliminate the need for a node group abstraction when provisioning nodes.

Karpenter offers intelligent scaling, cluster awareness, and customizable configurations while maintaining a modular design that seamlessly integrates with existing workflows. Whether it’s a small application or a massive workload, AWS Karpenter provides the necessary tools for scaling with ease. How Does AWS Karpenter Work?

Karpenter’s autoscaling approach differs from the standard cluster autoscaler. Rather than adding or removing nodes based on demand, Karpenter provisions nodes based on application requirements. This approach optimizes resource utilization and reduces costs.

It uses custom controllers and operators to manage nodes by monitoring the workload on your cluster and scaling the node groups to meet demand. Specifically, it uses custom Kubernetes resources called “provisioners” to define the resources it should provision. When an application requires more resources, Karpenter watches for any pending pods that Kubernetes can’t schedule. If necessary, Karpenter creates new resources and adds them to the cluster.
Karpenter is intelligent enough to understand your workload’s specific resource requirements and divide resources accordingly. It can handle pod requests for configurations like arm64-based instances or GPU. It also is aware of things like a pod’s volume claim Availability Zone requirements. It can correctly determine what zone to place a node in, avoiding a common issue with cluster autoscaler not making zone-aware scaling choices. 

While some may view Karpenter as just another tool, it is a powerful solution that can help scale Kubernetes workloads effectively.

Karpenter is an open-source cluster autoscaler that automatically provisions new nodes in response to unschedulable pods. Karpenter evaluates the aggregate resource requirements of the pending pods and chooses the optimal instance type to run them. It will automatically scale-in or terminate instances that don’t have any non-daemonset pods to reduce waste. It also supports a consolidation feature which will actively move pods around and either delete or replace nodes with cheaper versions to reduce cluster cost.

Best Practices

use for workloads with changing capacity needs

run karpenter controller on eks fargate

Karpenter is a relatively new project

consider using other autoscaling projects for non-basic features