Setup AWS Karpenter for EKS

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

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

Application Modernization: An Essential Step Towards Digital Transformation

Application Modernization: An Essential Step Towards Digital Transformation

What is Application Modernization and Why it is Important? The process of modernizing outdated software for newer computer paradigms, such …

Application Modernization: An Essential Step Towards Digital Transformation Read More »

Best Practices for Cost Optimization on AZURE Cloud 

Best Practices for Cost Optimization on Azure Cloud Computing Services

According to Microsoft, Azure has more than 68,000 partners and is a preferred choice for approximately 95% of Fortune 500 …

Best Practices for Cost Optimization on Azure Cloud Computing Services Read More »

AWS Security Group vs NACL

AWS Security Group vs NACL AWS Cloud provides significant protection natively to build a networking stack. There are two main …

AWS Security Group vs NACL Read More »