Skip to content

Lesson 2: Karpenter & Spot Fleet Autoscaling

🧠 The Concept (Explain Like I'm 5)

Traditional autoscaling is like buying pre-made shirts (S, M, L). If you need an XXL, you have to wait for the factory to make a new batch. Karpenter is a master tailor. It looks at the exact size of your app (Pod) and instantly sews a custom shirt (EC2 instance) that fits perfectly, right off the fabric roll (EC2 Fleet API).


🏢 The Enterprise Context

  • Bypassing ASGs: Cluster Autoscaler requires managing dozens of Auto Scaling Groups. Karpenter manages 0 ASGs. It provisions raw EC2 compute directly based on the Pods' CPU/RAM requests.
  • Spot Instance Orchestration: Karpenter aggressively hunts for cheap Spot Instances. When AWS reclaims a Spot instance, Karpenter gracefully evicts the Pods and replaces the node before the termination completes.

🗺️ Visual Architecture: Direct Compute Orchestration

flowchart LR
    Pod["Pending Pod<br/>(Requires GPU)"] --> Karpenter["Karpenter"]
    Karpenter -->|API Call| AWS["AWS EC2 Fleet"]
    AWS -->|Provisions| Node["g4dn.xlarge Node"]
    Node -->|Pod Starts| Ready["✅ Running"]