Kubernetes Cost Optimization: How to Cut Your K8s Bill by 40%
A practitioner's guide to cutting Kubernetes costs 40%: resource requests, right-sizing, spot nodes, autoscaler, quotas, and idle detection.
Kubernetes makes it easy to run workloads. It also makes it very easy to waste money at scale.
The resource model that gives you flexibility (request what you need, get scheduled accordingly) becomes a cost liability when those requests are set incorrectly. A pod requesting 2 CPU and 4GB RAM that uses 0.3 CPU and 600MB RAM is holding capacity on a node that cost real money to provision, even though most of that capacity sits idle.
Multiply that pattern across dozens of services. Add nodes that were never right-sized, a cluster autoscaler that scales up aggressively but scales down slowly, and no tooling to show what anything costs. That's a typical untuned Kubernetes environment.
The short answer: most Kubernetes waste comes from resource requests set far above real usage. Fix requests first, then move interruption-tolerant workloads to spot nodes, tune the autoscaler to remove idle nodes faster, delete idle workloads, and add cost attribution so it stays fixed. A 40% reduction is realistic for a cluster whose requests have never been tuned; teams that have already done some of this work should expect less.
This post covers every lever worth pulling, in order of typical impact.
Why Kubernetes Cost Is Hard to Control
It helps to understand why K8s costs get out of hand even in well-run engineering organizations.
Resource requests are set once and never revisited. A deployment manifest has resource requests defined when the service is first written. Those requests reflect the engineer's best guess at the time, usually with conservative headroom. Six months later, the service has been optimized and its traffic patterns are understood, but the original requests are 3x what the workload needs. Nobody goes back to tune them.
Costs are invisible at the workload level. Your AWS bill tells you what you spent on EC2 and EKS. It does not tell you which namespace, deployment, or team spent what. Without cost attribution, individual teams have no incentive to optimize their resource footprint.
Cluster autoscaler behavior is asymmetric by default. Nodes scale up quickly (good for reliability) and scale down slowly (bad for cost). The default scale-down delay is 10 minutes, but conservative configurations often push this to 30 to 60 minutes. A node that becomes underutilized at 2am may not be reclaimed until morning.
Spot/preemptible nodes are underused. Most teams know spot instances exist. Most haven't done the work of identifying which workloads can tolerate interruption and setting up the node pool separation needed to use them safely.
Each of these has a concrete fix.
1. Fix Resource Requests and Limits First
Typical savings: 20 to 35% of compute costs
This is the highest-leverage item in most environments, and it unlocks everything else. Cluster autoscaler cannot right-size your nodes if your pods are requesting 4x what they use. The scheduler sees demand that doesn't match reality, so the cluster stays larger than it needs to be.
Requests vs. Limits: The Distinction That Matters
Requests are what the Kubernetes scheduler uses to place pods on nodes. A pod requesting 1 CPU will only be scheduled on a node that has 1 CPU available. Requests directly determine how much node capacity you need, and therefore how much you spend.
Limits cap how much a pod can consume. A pod with a CPU limit of 2 CPU can burst up to 2 CPU if the node has capacity available, but it is guaranteed only what it requested. A pod with a memory limit that it exceeds gets OOMKilled.
The common failure modes:
- Requests too high, limits too high: Pods reserve capacity they don't use. Nodes appear full but are underutilized. New pods can't schedule, which triggers premature scale-up.
- Requests too low, no limits: Pods compete for resources unpredictably, which causes noisy-neighbor problems and intermittent performance degradation.
- No requests or limits set: Kubernetes assigns the BestEffort QoS class; these pods are the first evicted under node pressure, and workloads become unpredictable under load.
How to Right-Size Requests
Pull actual usage data before changing anything. For each deployment, collect P99 CPU and P99 memory usage over 7 to 14 days using Prometheus queries:
# P99 CPU usage by container over 7 days
quantile_over_time(0.99,
rate(container_cpu_usage_seconds_total{container!=""}[5m])[7d:5m]
)
# P99 memory usage by container over 7 days
quantile_over_time(0.99,
container_memory_working_set_bytes{container!=""}[7d]
)
Set requests at P99 usage × 1.2 (20% headroom). Set memory limits at P99 × 1.5 to absorb spikes without OOMKill. Set CPU limits generously or not at all: CPU throttling is a common, silent performance problem, and it's worse than the cost of leaving CPU limits unset.
VPA as an Automation Layer
The Kubernetes Vertical Pod Autoscaler (VPA) can automate request recommendations. Run VPA with updateMode: "Off" first. In that mode it analyzes usage and publishes recommendations without applying them. Review the recommendations against your P99 data, then apply selectively.
VPA in Recreate mode applies recommendations by evicting pods (Auto is deprecated). Use it with caution for stateful workloads. It's well suited to stateless services with low restart sensitivity.
2. Right-Size Your Node Types
Typical savings: 10 to 20% of node costs
Node type selection has a compounding effect: if your pods are right-sized, your node pool configuration determines how efficiently those pods pack onto nodes. A cluster running all m5.4xlarge nodes (16 vCPU / 64GB) will waste more capacity than a cluster running a mix of m5.2xlarge and m5.xlarge nodes, because pods that need 2 CPU / 4GB can't fill an m5.4xlarge without a lot of company.
Bin packing analysis: For each node pool, look at the actual allocatable CPU and memory, and compare it to the aggregate requests of the pods scheduled there. If nodes are consistently 30 to 40% allocated but "full" (no more pods fitting), you have a bin-packing problem: your pod sizes don't fit efficiently into your node sizes.
Tools for this analysis:
- Karpenter (AWS-native, recommended over cluster-autoscaler for new environments) selects node types dynamically from pending pod requirements and chooses the cheapest instance type that satisfies the workload
- Kubecost, on its Cluster Efficiency page, shows allocatable vs. requested vs. actual utilization per node pool
kubectl-resource-capacity, a CLI plugin, shows per-node allocation vs. utilization at a glance
3. Spot and Preemptible Nodes for Interruptible Workloads
Typical savings: 60 to 80% on covered compute (spot discount vs. on-demand)
AWS Spot Instances are advertised at up to 90% off on-demand, and Google Cloud's Spot VMs (which replaced preemptible VMs) offer similarly deep discounts. The trade is interruption: AWS gives two minutes' notice, Google Cloud 30 seconds. For the right workloads, this is the highest raw discount available in cloud compute.
What matters is workload classification. Not everything can run on spot, but more can than most teams assume.
Good candidates for spot nodes:
- Batch and ETL jobs (can checkpoint and retry)
- CI/CD build runners (ephemeral by design)
- Stateless microservices with multiple replicas (one interruption doesn't cause an outage)
- Dev and staging environments (tolerance for occasional disruption)
- Data processing pipelines with restart capability
Should stay on on-demand:
- Stateful services (databases, message queues, distributed storage)
- Single-replica deployments (one interruption = outage)
- Services with strict latency SLAs where pod restart is costly
- Control plane components
Implementation Pattern
Use node pool taints and pod tolerations to separate workloads cleanly:
# Spot node pool taint (apply to all spot nodes)
taints:
- key: "spot"
value: "true"
effect: "NoSchedule"
# Pod toleration for spot-eligible workloads
tolerations:
- key: "spot"
operator: "Equal"
value: "true"
effect: "NoSchedule"
# Node affinity preference (prefers spot, falls back to on-demand)
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
matchExpressions:
- key: "node.kubernetes.io/lifecycle"
operator: In
values: ["spot"]
For AWS, configure your node groups to use a diversified instance type list across multiple families and sizes. Sourcing capacity from multiple spot pools dramatically reduces interruption frequency.
Karpenter handles this more elegantly than managed node groups: you define a NodePool with a list of compatible instance families, and Karpenter selects the cheapest available type at scheduling time. Combined with spot prioritization and consolidation, Karpenter can cut node costs substantially versus static on-demand node groups.
4. Cluster Autoscaler Configuration
Typical savings: 10 to 20% by reducing idle node time
The cluster autoscaler adds nodes when pods can't schedule and removes nodes when they become underutilized. The default configuration is conservative on scale-down, which is safe but expensive.
Key Parameters to Tune
# cluster-autoscaler deployment args
- --scale-down-delay-after-add=5m # default: 10m - how long after scale-up before scale-down is considered
- --scale-down-unneeded-time=5m # default: 10m - how long a node must be underutilized before removal
- --scale-down-utilization-threshold=0.5 # default: 0.5 - node is "unneeded" if total requests < 50% of allocatable
- --max-node-provision-time=15m # fail fast on node provisioning issues
- --skip-nodes-with-local-storage=false # if you don't run local storage, set this to false
Reducing scale-down-unneeded-time from 10 minutes to 5 minutes has minimal reliability impact (a node that's been underutilized for 5 minutes is very unlikely to fill up again), but it materially reduces idle node time during traffic troughs. For environments with predictable diurnal traffic patterns, this is a quick win.
Expander strategy: The least-waste expander selects the node group that leaves the least unused CPU/memory after scheduling, which tends to produce better bin-packing than random. Check which expander your cluster runs and set --expander=least-waste if it isn't already.
Scale-Down Blockers
Check what's preventing scale-down in your cluster. Common blockers:
kube-systempods without aPodDisruptionBudget- Pods not managed by a controller (bare pods), and PodDisruptionBudgets that allow zero disruptions
- Pods with local storage attached
- Pods stuck in Terminating state
Run kubectl -n kube-system describe configmap cluster-autoscaler-status to see the autoscaler's view of each node group and why nodes aren't being removed.
5. Namespace Resource Quotas
Typical savings: indirect; prevents cost surprises and enforces team accountability
ResourceQuotas impose hard limits on the total CPU and memory that can be requested within a namespace. Without them, a single deployment with misconfigured requests can consume the entire cluster's allocatable capacity and trigger unnecessary node scale-up.
apiVersion: v1
kind: ResourceQuota
metadata:
name: team-quota
namespace: team-payments
spec:
hard:
requests.cpu: "20"
requests.memory: 40Gi
limits.cpu: "40"
limits.memory: 80Gi
pods: "50"
LimitRanges complement quotas by enforcing per-pod defaults and bounds. If a pod doesn't specify requests, LimitRange applies defaults; if a pod exceeds the max, it's rejected.
apiVersion: v1
kind: LimitRange
metadata:
name: default-limits
namespace: team-payments
spec:
limits:
- default:
cpu: "500m"
memory: "512Mi"
defaultRequest:
cpu: "100m"
memory: "128Mi"
max:
cpu: "4"
memory: "8Gi"
type: Container
The cost impact is indirect: quotas prevent uncontrolled resource consumption and make teams responsible for their own footprint. Paired with cost attribution tooling, they create the accountability that sustains long-term optimization.
6. Detect and Eliminate Idle Workloads
Typical savings: $500 to $5,000/month depending on environment size
Idle workloads are deployments that run and consume resources but serve no meaningful traffic. Common causes: feature flags that are permanently disabled, migrated services that weren't decommissioned, staging deployments that outlasted their sprint, and shadow services that were never promoted.
Detection Approach
Combine two signals: low CPU utilization and low request rate over a 30-day window.
# Deployments with average CPU < 1% of request over 30 days
avg_over_time(
rate(container_cpu_usage_seconds_total[5m])[30d:5m]
) / on(pod) kube_pod_container_resource_requests{resource="cpu"}
< 0.01
# Services with near-zero HTTP request rate over 30 days
sum(rate(http_requests_total[30d])) by (service) < 0.001
Any service matching both criteria is a decommission candidate. Build a list, assign owners, confirm whether the service is genuinely unused, and terminate. Document the process, because you'll repeat it quarterly.
Kubernetes Goldilocks (from Fairwinds) automates the detection step. It covers the namespaces you label (or all of them with --on-by-default) and flags over-provisioned and under-utilized workloads with specific remediation recommendations. It integrates with Vertical Pod Autoscaler recommendations to show the delta between current requests and optimal requests.
7. Horizontal Pod Autoscaler Optimization
Typical savings: 15 to 25% for traffic-variable workloads
HPA scales pod replicas based on CPU utilization, memory, or custom metrics. A common configuration, scaling on CPU at a 50% target, often over-provisions at steady state. Teams set minimum replicas conservatively, and the cluster runs more pods than traffic requires during low-traffic periods.
Tuning HPA for Cost Efficiency
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: api-service-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: api-service
minReplicas: 2 # Lower bound - confirm this handles your minimum traffic
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70 # Raise from a 50% target to 70% - allows higher utilization before scaling
behavior:
scaleDown:
stabilizationWindowSeconds: 300 # Wait 5 min of sustained low utilization before scaling down
policies:
- type: Pods
value: 2
periodSeconds: 60
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Pods
value: 4
periodSeconds: 60
For services with predictable traffic patterns, KEDA (Kubernetes Event-Driven Autoscaling) scales on custom metrics (queue depth, event rate, request latency) and can scale to zero during idle periods. A batch processor that handles jobs from an SQS queue and has zero jobs queued should have zero pods running. KEDA makes this simple.
8. Cost Monitoring and Attribution
Impact: enables and sustains all other optimizations
Every optimization above produces a one-time improvement. Cost monitoring turns it into a continuous practice. Without visibility at the namespace/service/team level, you won't see a cost regression until it shows up on the monthly cloud bill.
Kubecost
Kubecost is the most widely used Kubernetes cost monitoring tool (now owned by IBM). It allocates cloud costs to Kubernetes objects (namespaces, deployments, pods, labels) by combining node pricing data with actual resource usage. It produces per-namespace, per-team, and per-deployment cost breakdowns updated in near-real time.
Key features for cost optimization:
- Cost allocation by namespace, label, annotation, or cluster
- Efficiency score per workload (requested vs. actual usage ratio)
- Savings recommendations with estimated impact
- Budget alerts when namespaces exceed spend thresholds
- Request right-sizing recommendations based on observed usage
Kubecost has a free tier; paid plans add multi-cluster support and advanced reporting. For most SMB environments, the free tier or OpenCost is sufficient.
OpenCost
OpenCost is the CNCF-incubating open-source project underneath the cost allocation model. If you want the core allocation engine without Kubecost's UI and opinionated features, OpenCost is the right choice. It exposes a REST API and Prometheus metrics that fit cleanly into existing observability stacks.
| Tool | Best For | Cost |
|---|---|---|
| Kubecost (OSS) | Single cluster, full UI | Free |
| Kubecost (paid plans) | Multi-cluster, enterprise reporting | Quote-based |
| OpenCost | Custom integration, Prometheus-native | Free |
| AWS Cost Explorer + tags | Rough service-level breakdown | Free |
Tagging Strategy
Cost attribution works only with consistent labeling. Enforce these labels on all workloads:
metadata:
labels:
app.kubernetes.io/name: api-service
app.kubernetes.io/component: backend
team: payments
environment: production
cost-center: eng-platform
Use an OPA/Gatekeeper admission policy to reject deployments missing required labels. This enforces attribution hygiene at the point of deployment instead of retroactively.
Example: Savings on an Untuned Cluster
Here's an illustrative before/after for a 30-person engineering team running a SaaS application on EKS, spending approximately $45,000/month on Kubernetes compute, with requests that have never been tuned.
| Optimization | Monthly Savings | Implementation Effort |
|---|---|---|
| Resource request right-sizing (VPA recommendations) | $8,200 | 2 days |
| Spot node pools for stateless services (65% of workload) | $7,500 | 3 days |
| gp2 → gp3 EBS migration for PVCs | $800 | 2 hours |
| Cluster autoscaler tuning | $2,100 | 2 hours |
| Decommission 8 idle deployments | $1,400 | 1 day |
| HPA min-replica reduction + CPU target increase | $2,800 | 1 day |
| Reserved Instances for on-demand node pool baseline | $3,200 | 1 hour (commitment) |
| Total savings | $26,000/month | ~2 weeks |
$26,000/month on a $45,000 starting point is a 58% reduction, because this example assumes significant right-sizing debt from a period of rapid growth. Environments that have already done some optimization will see a smaller share; Flexera's 2026 State of the Cloud report puts average wasted public-cloud spend at about 29%. For the AWS bill outside the cluster (NAT gateways, storage, idle instances), see 15 AWS cost savings to check in every audit.
Prioritization: Where to Start
If you're doing this for the first time, run these in order:
- Deploy Kubecost: get visibility before touching anything. You cannot prioritize without data.
- Audit resource requests: pull P99 CPU and memory, compare to current requests, identify the largest deltas.
- Right-size the top 10 deployments by wasted resource cost: 80% of the waste is usually in 20% of the deployments.
- Configure spot node pools: identify interruptible workloads and move them to spot.
- Tune cluster autoscaler scale-down parameters: a one-hour config change.
- Deploy VPA with
updateMode: "Off": let it run for 7 days and review recommendations before applying. - Set ResourceQuotas per namespace: prevent future regressions.
This sequence can be completed in 2 to 3 weeks by one experienced engineer. Keeping it up is the harder part: reviewing Kubecost recommendations monthly, revisiting HPA and VPA settings when traffic patterns change, and decommissioning idle workloads quarterly.
Getting Help
The technical steps above are well documented. Execution is the hard part: identifying which recommendations are safe to apply, checking that right-sizing doesn't hurt tail latency for latency-sensitive services, configuring Karpenter correctly for your specific workload mix, and keeping the practice going over time.
Our Kubernetes management service includes a cost optimization audit as a standard engagement component. It covers resource right-sizing analysis, spot node pool configuration, autoscaler tuning, and Kubecost deployment with attribution reporting. For ongoing, multi-cloud cost governance beyond Kubernetes, see our FinOps management service; if you'd rather start with a one-time cleanup, the Cloud Bill Sprint delivers savings in a fixed two-week engagement.
If you're deciding who should own the cluster in the first place, platform engineering vs DevOps for SMBs covers when a platform team pays off. Book a free infrastructure assessment and we'll audit your current K8s spend, identify your top five savings opportunities by dollar impact, and provide a remediation plan with implementation effort estimates.
Running a specific Kubernetes cost problem, such as unusual NAT gateway charges, Fargate vs. EC2 cost questions, or PVC storage optimization? Contact us and we'll take a look.
Put this into practice
Book a free 30-minute call with a senior engineer about your infrastructure, or check your email security in 30 seconds.
Related Articles
Azure Cost Optimization for SMBs: A Practical Guide to Cutting Your Bill by 30%
A hands-on guide to cutting Azure costs for SMBs: reserved instances, right-sizing, storage tiers, and the spending traps most teams miss.
Cloud FinOps: 5 AWS Cost Mistakes SMBs Make in 2026
The five most expensive AWS cost mistakes small and mid-size businesses make in 2026, and the exact steps to fix them before they compound further.
15 AWS Cost Savings to Check in Every Audit
A 15-point AWS cost audit checklist: idle and oversized resources, NAT gateway waste, S3 lifecycle gaps, IPv4 charges, and how to find each one.
Get articles like this in your inbox
Practical security, infrastructure, and DevOps insights for teams in regulated industries. Sent every two weeks.