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
- Run OpenCost in the cluster, pointing it at your Prometheus.
- Configure cloud pricing integration so it uses your real rates rather than public list prices.
- 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.