Skip to main content
HB
Back to all articles
AWS & Kubernetes FinOpsJun 15, 20259 min read

Karpenter for EKS Cost Optimization: A Deep Dive with Real Config

A real, copy-pasteable YAML config, spot vs. on-demand strategy, and the exact math — tradeoffs included

Hasan Butt
MLOps & RAG Platform Engineer · Top Rated Upwork (100% JSS)
~70%Total Fleet Cost Reduction

System Architecture Diagram

Loading architecture diagram...

Interactive Infrastructure & Autoscaling Workbench

Test real-time workload scaling, toggle between rigid ASG capacity and Karpenter spot fleets, and simulate AWS spot reclamation events.

Interactive Infrastructure Workbench

Karpenter vs Static EKS Fleet Simulator

Adjust traffic load, trigger Spot interruption events, and watch the Karpenter provisioning loop in real-time.

Monthly Compute Spend$218/mo−$686/mo (~70% saved)
Scaling Provision Latency< 45sDirect EC2 Fleet API
Spot Compute Fleet Mix33%On-Demand pinned for Auth/Pay
Cluster Packing Efficiency88%ttlSecondsAfterEmpty: 30s
Workload Scenarios
Synchronous API (Payment/Auth)140 req/s
Requires 4 pods (pinned to On-Demand)
Batch / Queue Processing25 jobs/s
Requires 3 worker pods (eligible for Spot)
Demonstrates zero-downtime PDB drain & instant failover.
Cluster Healthy · 99.9% Production SLA
Active Nodes: 3
ip-10-0-1-31
m6i.large · us-east-1a
on-demand
vCPU Allocation1.8 / 2 cores
payment-svc-78f9auth-svc-99ab
ip-10-0-2-14
m6i.large · us-east-1b
on-demand
vCPU Allocation1.6 / 2 cores
payment-svc-78faauth-svc-99ac
ip-10-0-1-50
c6i.xlarge · us-east-1a
spot
vCPU Allocation3.4 / 4 cores
batch-worker-1telemetry-pod-1async-queue-1
Selected Node Detailsip-10-0-1-31 · m6i.large
Hourly Price$0.096/hr
Availability Zoneus-east-1a
Scheduled Pods2 pods
Karpenter Event Loop & Telemetry Stream
[00:01s][Karpenter] Controller observing 12 microservices. NodePool consolidation policy active.
[00:15s][FinOps] Spot fleet mix running at 33%. Compute burn reduced to $218/mo.
[00:30s][Consolidation] ttlSecondsAfterEmpty (30s) monitoring idle nodes across us-east-1a/b.

1. The Baseline Problem

The cluster ran on three static m5.xlarge On-Demand nodes with no autoscaling. Nodes were sized for peak-year traffic 24/7, keeping baseline CPU utilization at 18% to 22%.

Legacy Cluster Autoscaler could not be enabled safely because its 4- to 5-minute provisioning delay caused checkout pods to queue in Pending during burst surges. To prevent customer-facing dropouts, the team carried permanent idle over-provisioning.

2. What Karpenter Actually Changes

Karpenter is not just a tool for buying cheaper compute. It replaces static Auto Scaling Groups with a direct control loop:

  • Direct EC2 Fleet integration: Evaluates pending pod requests and launches exact instance types in under 90 seconds without waiting for ASG scaling activities.
  • Intelligent bin-packing & multi-family fallback: Diversifies across m5.xlarge, m6i.large, and c6i.xlarge across multiple availability zones.
  • Aggressive idle cleanup: With ttlSecondsAfterEmpty: 30, nodes terminate within 30 seconds of becoming empty, eliminating 24/7 idle waste.

3. The Production Config

Here is the Karpenter provisioner configuration deployed for the cluster:

apiVersion: karpenter.sh/v1alpha5
kind: Provisioner
metadata:
  name: default
spec:
  requirements:
    - key: karpenter.sh/capacity-type
      operator: In
      values: ["spot", "on-demand"]
    - key: node.kubernetes.io/instance-type
      operator: In
      values: ["m5.xlarge", "m6i.large", "c6i.xlarge"]
    - key: topology.kubernetes.io/zone
      operator: In
      values: ["us-east-1a", "us-east-1b"]
  weight: 100
  limits:
    resources:
      cpu: "64"
      memory: 256Gi
  providerRef:
    name: default
  ttlSecondsAfterEmpty: 30

To pin critical authentication and payment lock workloads to non-interruptible capacity, deployment manifests define an explicit nodeSelector:

# deployment-payment-service.yaml (excerpt)
spec:
  template:
    spec:
      nodeSelector:
        karpenter.sh/capacity-type: on-demand

4. Cost Math: Line-by-Line Breakdown

The combined infrastructure remediation produced the following measured cost impact:

Component Before After Delta
Compute (3× m5.xlarge On-Demand, 730h/mo) $657/mo
Karpenter mixed (~60% Spot avg) $274/mo −$383/mo
Static idle over-provision ~$190/mo ~$22/mo −$168/mo
NAT gateway (wrong-region transit) $94/mo $0 −$94/mo
Orphaned EBS + Elastic IPs $41/mo $0 −$41/mo
Total Monthly Infrastructure ~$982/mo ~$296/mo −$686/mo (~70%)

Note: Spot prices reflect us-east-1 6-month trailing average at time of engagement; actual savings vary based on spot pool depth and AZ availability.

5. What This Does Not Solve

Karpenter is not a universal fix for every workload:

  • Spot interruptions on stateful workloads: Stateful services with persistent volume attachments should never run on Spot without strict replication architectures.
  • GPU & ML model inference: LLM serving requires dedicated accelerator instances, specialized device drivers, and different provisioner constraints, as detailed in my Custom LLM Serving on Bare-Metal A100s breakdown.
  • Applications with slow graceful shutdown: Workloads requiring more than 2 minutes to drain will get forcibly terminated by AWS Spot notices unless handled with pre-drain hooks.

6. Is This "Just Reading the Manual"?

Karpenter documentation is thorough and well-written. The challenge was never copy-pasting a provisioner manifest; it was diagnosing which manuals were relevant across multiple overlapping failure modes:

The team was dealing simultaneously with JVM off-heap memory exhaustion (512MB heap in a 512MB container limit), misconfigured liveness probes that killed restarting pods during 45s warmup windows, and network egress surcharges from dead NAT gateway routes. Making Karpenter effective required concurrent remediation across the JVM memory model, Kubernetes probe lifecycles, and AWS VPC routing under production SLA constraints.

7. Frequently Asked Questions

Q: How does Karpenter reduce EKS scaling latency?
A: Karpenter provisions nodes on demand from a weighted, multi-AZ instance pool — under 90 seconds here vs 4–5 minutes with a managed node group, eliminating queue/Pending build-up on spikes.

Q: Is Karpenter cheaper than EKS Cluster Autoscaling?
A: Primarily yes — Karpenter bin-packs + favors spot + terminates idle nodes (ttlSecondsAfterEmpty) rather than treating whole node groups as units. In this engagement it cut the compute bill ~70%.

Q: Does spot autoscaling hurt reliability?
A: Not by itself if you pin stateful/critical services (payment, auth) to On-Demand via node-selector and use Spot only for bursty, interruptible work. Mixed provisioner covers both.

Related Case Study & Infrastructure Audit

To see the complete production deployment context, JVM off-heap metrics, and SRE incident response setup, inspect the Production EKS Platform Case Study →. If your team is navigating runaway Kubernetes or GPU bills, book a free 20-minute infrastructure audit for a direct engineer-to-engineer teardown.

Need to Optimize Your AI Infrastructure or Cut GPU Spend?

I audit AI architectures for startups and growth teams to eliminate bottlenecks, cut inference costs by 30–60%, and deliver zero-downtime deployments.

Book a Free 20-Min Infrastructure Audit