Docker & Kubernetes

Kubernetes Cost Optimization: Practical Ways to Cut Your Cloud Bill

Home Blog Docker & Kubernetes

Docker & Kubernetes

Kubernetes makes it very easy to ask for more resources and very hard to see what you're actually paying for. Most clusters we review are significantly over-provisioned. Here are the changes that usually save the most, roughly in order of effort.

1. Make costs visible first

You can't optimise what you can't see. Install a cost-visibility tool such as OpenCost or Kubecost, or use your cloud provider's built-in reports, and break spending down by namespace, team and application. Label everything with team, app and env so costs can be attributed.

2. Right-size resource requests

The scheduler reserves capacity based on requests, not actual usage. A pod that requests 2 CPUs but uses 0.2 still blocks 2 CPUs of node capacity that you're paying for.

  • Compare requests with real usage over a few weeks (Prometheus or your cloud's metrics).
  • Set requests close to typical usage, with memory limits to protect the node.
  • Use the Vertical Pod Autoscaler in recommendation mode to suggest values without changing anything automatically.

Right-sizing alone is often the single biggest saving, because it lets the same workloads fit on fewer nodes.

3. Autoscale both pods and nodes

  • Horizontal Pod Autoscaler (HPA) adds and removes replicas based on load.
  • Cluster Autoscaler or Karpenter adds and removes nodes to match. Karpenter also picks the cheapest instance types that fit pending pods.

Together they let the cluster shrink at night and at weekends instead of sitting at peak size all the time.

4. Use spot or preemptible nodes for the right workloads

Spot instances are much cheaper than on-demand, but the provider can reclaim them at short notice. They're ideal for:

  • stateless web replicas (with several replicas spread across nodes),
  • batch jobs, CI runners and scraping workers,
  • dev and staging environments.

Keep databases and anything stateful or singleton on on-demand nodes, and use PodDisruptionBudgets so evictions never take down all replicas at once.

5. Consider ARM nodes

ARM-based instances usually offer better price-performance for typical web workloads. If your images are already built multi-arch, adding an ARM node pool is often a low-risk change.

6. Switch off what nobody is using

  • Scale dev and staging to zero outside working hours with a scheduled job or a tool like kube-downscaler.
  • Delete abandoned preview environments automatically after a few days.
  • Clean up orphaned volumes, load balancers and snapshots. They keep billing long after the workloads are gone.

7. Watch the "hidden" costs

  • Load balancers: one per service adds up. Use a single Ingress controller for many services.
  • Data transfer: cross-zone and internet egress traffic can be surprisingly expensive.
  • Logging: sending every debug log to a paid log service is a classic bill-shock source. Set retention and log levels deliberately.

8. Commit for the baseline

Once usage is right-sized and stable, cover the always-on baseline with reserved instances or savings plans, and let autoscaling with spot handle the peaks.

Make it a habit

Cost optimisation isn't a one-time project. A short monthly review of the cost dashboard catches drift before it becomes expensive.

Want to know how much your cluster could save? Our Cloud & DevOps team offers cluster cost reviews with concrete, prioritised recommendations.