How to Setup AWS Karpenter for EKS

Setup AWS KARPenter for EKS
January 12, 2023
Setup AWS KARPenter for EKS

Setup AWS Karpenter for EKS

Kubernetes’ ability to dynamically scale infrastructure based on demand is a major benefit. Kubernetes provides multiple layers of autoscaling functionality: the Horizontal Pod Autoscaler (HPA), the Vertical Pod Autoscaler, and the Cluster Autoscaler. Together, these allow you to ensure that each pod and cluster is just the right size to meet your current needs.

Karpenter:  

Karpenter is an open-source, high-performance Kubernetes cluster auto scaler that takes advantage of the AWS API to launch instances according to what your Kubernetes cluster needs. If you are familiar with GKE Autopilot, Karpenter observes the pod specifications of unschedulable pods, calculates the aggregate resource requests, and sends a request to the compute service like Amazon EC2 with the capacity required to run all the new pods.

Setup AWS KARPenter for EKS

  

Conversely, Karpenter can also deprovision nodes when they are no longer needed. This can be determined by node expiry config (ttlSecondsUntilExpired) or when the last workload running on Karpenter provisioned node is terminated.

Cluster Autoscaling 

Cluster auto-scaler is an industry-adopted, open-source, and vendor-neutral tool, and it is part of the Kubernetes project, with implementations by most major Kubernetes cloud providers. Cluster Autoscaling will increase or decrease the size of a Kubernetes cluster (by adding or removing worker nodes) based on the presence of pending pods and multiple metrics.

Karpenter vs. Cluster Autoscaler  

Cluster Autoscaler will only scale up or down your managed node groups through Amazon EC2 Auto Scaling Groups. It requires the ability to examine and modify EC2 auto-scaling groups. So, it watches the node groups. Whenever we add a new node group, we must tell Cluster Autoscaler about it because of the mapping that Cluster Autoscaler is Kubernetes native, and the node group is AWS native.

Karpenter manages each instance directly, without additional orchestration mechanisms like node groups. Karpenter looks at the workload (i.e., pods) and launches the right instances for the situation. Instance selection decisions are intent-based and driven by the specifications of incoming pods, including resource requests and scheduling constraints.

How does Karpenter work? 

  1. Karpenter observes the pod resource requests of unscheduled pods. 
  2. Direct provision of Just-in-time capacity of the node. (Groupless Node Autoscaling) 
  3. Karpenter will terminate nodes if they are outdated. 
  4. Karpenter can relocate the pods in nodes for better resource utilization. 
  5. Karpenter will decide which instance type is best for the scheduled pod, thus driving the cost down regularly. 

Karpenter allows you to use all the flexibility of the cloud. That means you use all of the EC2 instance types AWS offers. Also, you can choose the purchase options like On-Demand and Spot Availability Zone options.

Karpenter does not require Node Groups to manage each instance directly without additional orchestration mechanisms.

In Cluster Autoscaler, you must configure Node Groups for each instance type, purchasing options. That brings operational overhead.

With Karpenter, you don’t need to rely on the kube-scheduler. When Cluster Autoscaler launches a node, it doesn’t bind the pods to those nodes. Kube-scheduler makes that decision.

Conclusion 

Karpenter is designed to work alongside existing AWS Capacity providers such as EKS Managed node groups and ECS Auto scaling groups. Customers can use a mixed model of cluster capacity management. Over the long term, it is expected that Karpenter will be leveraged increasingly as the premier dynamic cluster node manager. 

Cloud Computing Insights and Resources

Cloud Consulting

6 Reasons to Collaborate with a Cloud Consulting Firm in 2024

The technology landscape keeps evolving, without a break, and the shift towards cloud solutions is undeniable. Companies are increasingly embracing […]

cloud computing

10 Secrets of Optimum Utilization of Clouds 

Cloud computing has emerged as a significant trend in recent years, transforming how businesses operate and delivering a range of […]

AWS migration

An Introduction to AWS’ Migration Acceleration Program

What is AWS MAP?  The Migration Acceleration Program (MAP) stands as an exclusive offering from Amazon Web Services (AWS), available […]