Kubernetes Cost Optimization: A Practical FinOps Checklist
Cloud infrastructure bills frequently balloon because engineering teams size Kubernetes resource requests for peak holiday traffic rather than typical utilization. FinOps is not about starving services of resources—it is about designing automated elasticity so infrastructure cost maps linearly to business revenue.
1. The Resource Request vs. Limit Pitfall
Kubernetes schedules pods based on "requests", not "limits". If an engineer assigns a pod 4 CPU cores and 8GB RAM as a request, Kubernetes reserves that capacity entirely on the node, even if the pod is consuming 200m CPU and 500MB RAM.
Furthermore, setting arbitrary CPU limits can cause the Linux kernel CFS quota scheduler to artificially throttle your application threads even when the host node has ample free CPU cycles. Modern Kubernetes best practice recommends setting accurate requests while omitting CPU limits (or setting them high), pairing this with memory requests equal to limits.
2. Karpenter: Just-In-Time Node Provisioning
Traditional Kubernetes Cluster Autoscaler relies on static node groups (e.g. m5.2xlarge). When a 100MB pod cannot fit, it provisions an entire new m5.2xlarge instance. AWS Karpenter replaces static node groups by communicating directly with the EC2 fleet API, launching the exact instance type needed in under 45 seconds.
apiVersion: karpenter.sh/v1beta1
kind: NodePool
metadata:
name: general-compute
spec:
template:
spec:
requirements:
- key: "karpenter.sh/capacity-type"
operator: In
values: ["spot", "on-demand"]
- key: "kubernetes.io/arch"
operator: In
values: ["arm64", "amd64"]
- key: "karpenter.k8s.aws/instance-category"
operator: In
values: ["c", "m", "r"]
nodeClassRef:
name: default-ec2-node-class
limits:
cpu: "1000"
memory: 2000Gi
disruption:
consolidationPolicy: WhenUnderutilized
expireAfter: 720h3. Step-by-Step FinOps Checklist for Kubernetes
Before buying savings plans or reserved instances, complete these architectural optimizations:
1. Install OpenCost or Kubecost to attribute monthly spend to specific Kubernetes namespaces and teams.
2. Run Vertical Pod Autoscaler (VPA) in recommendation mode for 14 days to collect real p99 resource utilization metrics.
3. Migrate non-critical background workers and batch queues to AWS Spot / GCP Preemptible nodes with PodDisruptionBudgets.
4. Implement automated namespace TTL cleanups in non-production environments to terminate development clusters on weekends.
Technical References & Industry Standards
- Karpenter Kubernetes Autoscaling — High-performance, flexible Kubernetes cluster autoscaler built for AWS.
- OpenCost Specification — Vendor-neutral open source project for tracking Kubernetes cloud costs in real time.
DevOps Consulting & Cloud
Explore how AEITCH engineers implement production architectures for enterprise clients.