Scaling & Optimizing Kubernetes with Karpenter - An AWS Community Day Talk
Romar Cablao
Posted on October 1, 2024
Overview
This blog post summarizes my presentation delivered at AWS Community Day PH 2024, held in AWS Office - Taguig City, Philippines. The presentation explored the concept of automated scaling in Kubernetes and showcased Karpenter, an open-source tool for autoscaling cluster resources.
Kubernetes Scaling
While Kubernetes excels at scaling workloads through kube-scheduler, it lacks the ability to automatically manage the underlying compute resources of the cluster (CPU, memory and storage). This is where tools like Karpenter come in.
Karpenter continuously monitors unscheduled pods and their resource requirements. Based on this information, it selects the most suitable instance type from your cloud provider and provisions new nodes to accommodate the workload demands. This "just-in-time" provisioning ensures your applications always have the resources they need to run smoothly, without the risk of over provisioning and incurring unnecessary costs.
Also worth noting of - Karpenter just recently graduated from Beta version. In August, v1.x was released.
Karpenter in Action
If you want to see Karpenter in action, you can use the OpenTofu template in the repository below to provision an Amazon EKS cluster with Karpenter pre-configured:
For the NodePool configuration, you can use the one defined within the repository. The configuration would look like this:
A video recording was also available to see Karpenter in action. Few things to note, the video shows two applications - (1) Terminal running eks-node-viewer on the top and (2) Lens showing the deployment we are about to scale and the Karpenter logs.
The video focuses on three key actions to illustrate how Karpenter responds to cluster resource autoscaling needs:
Scaling from zero (0) to two (2) replicas: This demonstrates how Karpenter provisions new nodes when additional resources are required.
Scaling from two (2) to six (6) replicas: This showcases Karpenter's ability to scale up further as demand increases.
Scaling from six (6) back to zero (0): This demonstrates how Karpenter can also scale down and terminate nodes when resources are no longer needed, optimizing resource utilization.
By watching this video demonstration, you can gain a practical understanding of how Karpenter dynamically provisions and manages cluster resources based on workload demands.
Ready to explore the potential of Karpenter for your Kubernetes clusters? Check out the links below to get started 🚀