When it comes to scaling Kubernetes workloads, whether you’re optimizing for cost or resources, you may need to scale worker nodes up or down in either scenario. Karpenter is a just-in-time node approach for scaling nodes both up and down. AWS recently donated Karpenter to CNCF

While most people think of the native Kubernetes Cluster Autoscaler (CAS), there are other scaling mechanisms out there as well, and conceptually, they’re all doing the same thing — scaling worker nodes up or down depending on loads (defined as CPU and memory).  However, the big appeal of Karpenter is that it has been tested to achieve higher performance than the CAS for both scaling up and down. If you look at the performance tests published online, you’ll see that Karpenter does typically beat CAS. 

The core difference lies in their approach: Cluster Autoscaler adjusts cluster size based on pending pods and current resource utilization, focusing on stability, while Karpenter proactively launches and terminates nodes to meet application demands, prioritizing speed and efficiency swiftly.

Underlying these approaches to autoscaling, it’s paramount to set CPU and memory requests and limits. Requests are the minimum resources a container is guaranteed to have access to while limits are the maximum resources a container can consume on a node. They allow users to isolate CPU, memory, ephemeral storage, and extended resources. (StormForge Optimize Live automates this process, so users can stop setting requests and limits.)

Combining the setup of all these is important to ensure that workloads and clusters are both performing as best as possible. It’s all a game of optimization to ensure application stacks are running as they should be. 

Watch Michael Levan walk through the Karpenter setup and installation process in an AWS EKS environment.