From this case study you will learn
- where to run Karpenter so it does not depend on the nodes it manages
- where to keep shared data and where to keep objects and backups
- how to scale to tens of thousands of pods without adding nodes by hand
- how to upgrade Kubernetes without interrupting the applications
The client needed an environment for applications that run around the clock and have to cope with large swings in load. Losing one AWS availability zone could not stop the services, and upgrades could not require maintenance windows. We designed, built and now operate an Amazon EKS cluster that meets those conditions.
Requirements
The application is made of many services with different CPU and memory needs. Some of them share files, others write large numbers of objects. Load rises and falls during the day, so a fixed number of servers would mean either overpaying or running out of capacity at the peak.
We agreed on four conditions: running across several availability zones, automatic scaling, durable data independent of pods, and upgrades without downtime.
Architecture
The cluster runs across several availability zones in one region. All applications run on EC2 nodes managed by Karpenter. Karpenter does not manage Fargate, so Fargate has one job here: it runs the Karpenter controller itself. The controller runs outside the nodes it replaces and shuts down, so changes to those nodes do not stop it.
Karpenter picks the instance type and size to match pod requirements, and a load balancer takes internet traffic and spreads it across all zones.
Data on EFS and S3
Files used at the same time by many pods in different zones live on Amazon EFS. A pod can move to another node or another zone and still see the same data.
Objects, exports and backups go to Amazon S3. Lifecycle rules move older data to cheaper storage classes. Only the services that need data have access to it.
Scaling with Karpenter
Karpenter watches pods waiting for resources and launches nodes that fit them. When load drops, it packs pods onto fewer nodes and shuts down the rest. At the peak the cluster runs tens of thousands of pods on hundreds of nodes.
Pods are spread across zones, and Pod Disruption Budgets make sure the required number of replicas of each service keeps running while nodes are replaced.
Upgrades without downtime
Kubernetes ships new versions several times a year. A version that leaves standard EKS support moves to paid Extended Support, so we upgrade the cluster regularly.
Before every upgrade we check that applications do not use deprecated APIs and test the change in a staging environment. Then we upgrade the control plane, the cluster add-ons and the nodes. Karpenter replaces nodes gradually, and disruption budgets keep the applications running.
Business continuity
The cluster, nodes, pods and data are monitored with alerts. We see pods waiting for resources, application errors and the state of every zone. The client does not add servers by hand or plan maintenance windows, and the infrastructure grows with the traffic. We build similar environments as part of our Cloud service.
Write to us