How to Setup AWS Karpenter for EKS

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

Written by Manish Juneja

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 autoscaler 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

  

On the other side, 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 autoscaler 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 have to 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 the use of 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. 
  1. Direct provision of Just-in-time capacity of the node. (Groupless Node Autoscaling) 
  1. Karpenter will terminate nodes if they are outdated. 
  1. Karpenter can relocate the pods in nodes for better resource utilization. 
  1. Karpenter will decide which instance type is best for the scheduled pod, thus will drive the cost down on a regular basis.  

Karpenter allows you to use all the flexibility of the cloud. That means you use all of the EC2 instance types AWS has to offer. 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 the use of additional orchestration mechanisms.  

In Cluster Autoscaler, you need to 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 more and more as the premier dynamic cluster node manager. 

Cloud Computing Insights and Resources

Generative AI solution on Enterprise Data

Generative AI solution on Enterprise Data

Written By: Kumar Shanu, Machine Learning Specialist, Rapyder Cloud Solutions Generative AI is a powerful technology that can create new …

Generative AI solution on Enterprise Data Read More »

Extracting email attachment using AWS

Extract Email Attachment Using AWS

Written by – Manish Juneja Email is the most primitive form of person-to-person communication in the post-internet era. It’s extremely …

Extract Email Attachment Using AWS Read More »

Finding & Notifying Unused AWS EBS Volumes Using Lambda

Using AWS Lambda, Event Bridge, & SNS for finding & notifying unused AWS EBS volumes

Written By: Manish Juneja Overview Cloud cost control is one of the top goals for customers across all sectors and …

Using AWS Lambda, Event Bridge, & SNS for finding & notifying unused AWS EBS volumes Read More »