Kubernetes

Kubernetes cost allocation with OpenCost

How to get cost per namespace, team and workload in Kubernetes using OpenCost, and the labelling habits that make the numbers trustworthy.

28 September 2026 · 6 min read · Serverconfigs engineering

A Kubernetes cluster is a shared resource, which makes the cloud bill nearly useless for answering “what does this team cost?”. The invoice shows nodes. Teams use pods.

What OpenCost does

OpenCost is an open-source project that allocates cluster cost to namespaces, controllers, pods and labels, using resource requests and usage together with your cloud’s pricing. It exposes the results through an API and Prometheus metrics, so you can chart them in Grafana.

Getting started

  1. Run OpenCost in the cluster, pointing it at your Prometheus.
  2. Configure cloud pricing integration so it uses your real rates rather than public list prices.
  3. Check the numbers against the node bill. Allocated cost plus idle cost should reconcile with what you pay for nodes.

The decisions that matter more than the tool

Labels. Decide on a small, mandatory set: team, service, environment. Enforce them with admission policy (Kyverno or OPA) so a workload without them cannot deploy.

Idle cost. Capacity nobody requested is still a cost. Decide whether it is shared across teams, charged to the platform team or shown separately. Showing it separately tends to start useful conversations.

Requests versus usage. Allocation by request penalises teams who over-request and rewards teams who set values honestly. That is usually the incentive you want, but explain it first.

Shared services. Ingress controllers, monitoring and DNS serve everyone. Allocate them by a simple rule, such as proportional to usage, and write the rule down.

What to do with the numbers

Put cost per team on the dashboards engineers already use. Review the top five movers monthly. Pair allocation with right-sizing work: lowering requests where usage is consistently far below them is often the biggest saving.

See our Kubernetes cost and health check for how we run this in practice.

Serverconfigs engineering

Notes from the engineers who run cloud cost, platform and AI enablement work for clients.

Keep reading

Related articles.

Newsletter

Practical notes on cost, platform engineering and AI infrastructure. See the Privacy Policy.

Start here

Find the waste first.

45 minutes with an engineer, a read-only look at your bill and a clear list of what to fix.

45-min call with an engineer · Read-only access · No commitment

Talk to an Engineer Free Cost Assessment