DevOps · CNCF daily

OpenCost: Vendor-Neutral Kubernetes Cost Monitoring

CNCF Incubating. An open standard and in-cluster service that allocates cloud and infrastructure spend to namespaces, workloads, containers and labels, so teams can see what Kubernetes actually costs.

7 min read

CNCF Incubating

  • OpenCost
  • Prometheus
  • Grafana
  • Kubernetes
  • FinOps
CNCF project page

OpenCost is a vendor-neutral specification and open-source implementation for measuring and allocating the cost of Kubernetes workloads. A cloud bill lists nodes, disks and load balancers, but not which team, namespace or application caused them. OpenCost joins live resource usage from the Kubernetes API and Prometheus with pricing from cloud providers or a custom price list, and attributes the result to namespaces, deployments, containers, labels and more. It was launched by Kubecost together with engineers from Amazon, Adobe, Google, Microsoft and SUSE, entered the CNCF Sandbox in 2022, and was announced as an Incubating project on October 31, 2024. It aligns its allocation model with the FinOps Foundation, which gives engineering and finance teams a shared vocabulary.

CNCF daily · Sprint 1, day 7 · Continuous Optimization

At a glance

Category Continuous Optimization
CNCF status Incubating. Joined the Sandbox in 2022; Incubating announced October 31, 2024
Written in Go
License Apache 2.0
Cost sources AWS, Google Cloud, Azure and OCI pricing, on-premises custom pricing, and out-of-cluster cloud costs
Outputs REST API, web UI, and Prometheus metrics for dashboards and alerts
Extensions Plugin framework for external cost sources, with plugins such as Datadog, OpenAI and MongoDB Atlas
Scope Allocation and visibility. It does not change cluster resources

Architecture

flowchart TB
  K8S[Kubernetes API<br/>nodes, pods, PVCs, labels] --> OC
  PROM[Prometheus<br/>CPU, memory, network usage] --> OC
  PRICE[Pricing sources<br/>cloud APIs, billing exports, custom CSV] --> OC
  subgraph OCG[OpenCost]
    OC[Cost model<br/>usage times price, per workload]
    OC --> API[REST API and UI]
    OC --> EXP[Prometheus exporter<br/>cost metrics]
  end
  PLUG[Plugins<br/>Datadog, OpenAI, MongoDB Atlas] --> OC
  EXP --> PROM2[Prometheus and Alertmanager]
  PROM2 --> GRAF[Grafana dashboards<br/>and budget alerts]
  API --> FIN[Engineering and FinOps reviews]
Component Responsibility
Cost model Combines resource requests, usage and prices to compute the cost of each pod, then rolls it up by namespace, controller, label or node.
Prometheus Supplies the usage metrics. OpenCost needs its scrape configuration for the metrics it expects.
Pricing layer Uses on-demand list prices at once, and can reconcile with billing exports from AWS, Azure and Google Cloud.
API and UI A REST API for allocation and asset queries, and a built-in web interface.
Exporter Publishes cost metrics to Prometheus, so Grafana dashboards and Alertmanager rules use the same data.
Plugins Bring cost from external services into the same view.

Design principle. OpenCost separates measurement from action. It produces trustworthy, standard cost allocation data from open interfaces, and leaves decisions, such as rightsizing, autoscaling or scheduling changes, to the teams and tools that act on it.

Production reference design

A common pattern on EKS, GKE, AKS or on-premises Kubernetes: one OpenCost per cluster, reading from the cluster’s Prometheus, with dashboards and budget alerts built on its metrics.

  1. Prepare Prometheus. Use the cluster’s existing Prometheus, or install one, and add the scrape configuration that OpenCost documents. Without it, cost data does not populate.
  2. Install with Helm into its own namespace, with a values file that sets the Prometheus address and a cluster name:
    helm repo add opencost https://opencost.github.io/opencost-helm-chart
    helm install opencost opencost/opencost \
      -n opencost --create-namespace -f values.yaml
    # values.yaml (check keys against the chart version you install)
    opencost:
      prometheus:
        internal:
          serviceName: prometheus-server
          namespaceName: monitoring
      exporter:
        defaultClusterId: prod-eks-01
      ui: { enabled: true }
  3. Connect real pricing. Configure the cloud integration for your provider, such as the AWS Cost and Usage Report, the Azure rate card or Google Cloud billing export, so allocation reflects your own prices and not list prices. For on-premises clusters, supply a custom price file.
  4. Standardise labels. Require team, app and env labels on workloads, or use namespace conventions, so costs can be attributed. Unlabelled spend becomes the first thing to fix.
  5. Build views and alerts. Graph cost by team and namespace in Grafana from the exported metrics, and add Alertmanager rules for budget breaches and sudden changes: Take metric names from the exporter’s documentation for the version you run, and test each rule before relying on it.
  6. Review on a cadence. Share monthly showback reports with each team, and compare requested against used resources to find waste.
  7. Act through other tools. Use the findings to adjust requests and limits, autoscaling with KEDA, node pools or commitments. OpenCost informs these changes but does not make them.

Typical production uses include showback and chargeback by team, finding idle and over-provisioned workloads, cost-aware capacity planning, and reporting cloud and AI service spend alongside cluster cost.

Operational considerations

  • Data quality depends on Prometheus. Check that the scrape configuration and retention are correct, and that RBAC is in place, since a missing permission can fail without an obvious error.
  • List prices are not your prices. Out of the box, allocation uses on-demand pricing. Savings plans, committed-use discounts and enterprise agreements need billing integration or reconciliation to match your invoice.
  • One instance per cluster. The open-source tool reports on one cluster at a time. For a fleet, aggregate the exported metrics in a central Prometheus or Thanos, or use a commercial layer.
  • Visibility only. OpenCost does not recommend sizes, send alerts by itself or change anything. Plan the alerting rules and the owners who act on the data.
  • Idle and shared cost need a policy. Decide how idle capacity, shared services and cluster overhead are split, and apply the same rule every month so reports stay comparable.
  • Keep the stack current. Pin chart and image versions, and read release notes when upgrading, since cost model and metric names can change.

Adoption

  • The CNCF incubation announcement names Amazon, Adobe, Google, Microsoft and SUSE as supporting organisations, with Adobe, Google and SUSE as contributors.
  • Kubecost, which launched the project, builds its commercial product on the OpenCost core.
  • The project is described as the most widely adopted open-source Kubernetes cost tool, and maintains an adopters list in its repository. Specific user counts are not published in the sources used for this brief.

Alternatives

Solution Model Best suited to
Kubecost Commercial product built on OpenCost, with multi-cluster views and recommendations Teams that want fleet-wide reporting and support
Cloud provider tools (AWS Cost Explorer with split cost allocation, Azure Cost Management, Google Cloud billing) Provider billing reports Single-cloud teams that need invoice-accurate numbers
Cast AI and similar automation platforms Commercial cost optimisation with automation Teams that want rightsizing and node changes made automatically
Karpenter and KEDA Autoscaling that reduces cost through capacity Acting on cost findings, rather than measuring them
Custom Prometheus and billing queries Self-built dashboards Small setups with simple needs

Strengths and limitations

Strengths Limitations
Open, vendor-neutral standard aligned with FinOps Visibility only, with no recommendations or automation
Allocates by namespace, workload, container and label Defaults to list prices until billing is integrated
Prometheus metrics fit existing dashboards and alerts Needs a healthy Prometheus and consistent labels
Works on AWS, Google Cloud, Azure, OCI and on-premises One cluster per instance in the open-source version
Plugins extend it to external services and AI spend Idle and shared cost allocation still needs policy decisions

Recommendation

Adopt OpenCost as the baseline for Kubernetes cost visibility, wired to the cluster’s Prometheus and Grafana, with billing integration and enforced labels so numbers match the invoice and map to owners. Assess a commercial layer if you need multi-cluster views, recommendations or automation, and pair OpenCost with autoscaling tools to act on what it shows.

References: CNCF project page · CNCF blog: OpenCost advances to the CNCF Incubator · Apptio: Celebrating OpenCost’s journey to CNCF incubation · OpenCost incubation post · OpenCost documentation · OpenCost on GitHub

Spotted something wrong or out of date?Suggest a correction. I review every suggestion before changing the page.