opencost

Deploy, price, query, and troubleshoot OpenCost for Kubernetes cost allocation.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/lurodrisilva/personal-skills --skill opencost-lurodrisilva
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: opencost
Source: https://github.com/lurodrisilva/personal-skills/tree/main/platform-engineering/opencost
Command: npx skills add https://github.com/lurodrisilva/personal-skills --skill opencost-lurodrisilva

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Kubernetes teams cannot answer "what did this workload cost, and where did that number come from?" without a working measurement plane. This Skill guides the full OpenCost lifecycle — deployment, Prometheus wiring, cloud billing integration, API querying, exports, and troubleshooting — so every cost figure is qualified by its pricing source, window, and idle treatment instead of being an unlabeled guess. ## Core Features & Use Cases - Deployment & Prometheus wiring: Install OpenCost via Helm, raw manifest, Docker, or exporter-only chart, configure the mandatory job_name: opencost scrape target, and set up multi-cluster identity against Thanos/Cortex/Mimir. - Pricing configuration: Wire AWS Athena/CUR, Azure RateCard, GCP BigQuery billing export, or custom on-prem pricing through cloud-integration.json with least-privilege, read-only credentials (IRSA, GKE Workload Identity). - Querying, exports & troubleshooting: Query /allocation, /assets, /cloudCost, and /customCost/* with correct window/aggregate/resolution/idle semantics, export to CSV/Parquet, use the MCP server, and diagnose empty data, 500s, and negative idle. - Use Case: A platform engineer notices the allocation API returns empty data. The Skill directs them to verify the Prometheus scrape target first, run the read-only health and pricing-check scripts, and confirm whether numbers reflect list pricing or a real cloud billing integration. ## Quick Start Ask the agent to install OpenCost into the opencost namespace with Helm, wire the Prometheus scrape config, and verify the deployment answers /allocation/compute with non-empty data.

Frequently Asked Questions about opencost

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I install OpenCost on a Kubernetes cluster with Helm?▼

Add the opencost-charts Helm repository and install into the opencost namespace with your values.yaml. An existing Prometheus is required, and you must add the job_name: opencost scrape config or no cost history will be collected.

How do I connect OpenCost to AWS, Azure, or GCP billing data?▼

Create a cloud-integration.json with the provider key (AWS Athena/CUR, Azure storage export plus RateCard, or GCP BigQuery export), store it in the cloud-costs secret, and enable cloudCost in Helm values. Prefer IRSA or GKE Workload Identity over static keys.

OpenCost vs Kubecost: what is the difference?▼

OpenCost is the CNCF open-source project providing real-time cost monitoring at on-demand list pricing. Kubecost is the commercial superset that reconciles against the published bill with negotiated discounts, so OpenCost alone does not give invoice-accurate reconciliation.

Why does the OpenCost allocation API return a 500 or empty data?▼

A 500 or empty response almost always means the job_name: opencost scrape target is missing or wrong in Prometheus, so no history exists. Verify the scrape config and that up{job="opencost"} equals 1 before debugging anything else.

Why is OpenCost showing negative idle cost?▼

Negative idle indicates OpenCost lacks Prometheus history, typically from a missing scrape target, so workload costs exceed recorded asset costs. Idle is a cluster bin-packing metric and should be reported separately from tenant allocations.

Can OpenCost allocate costs for on-prem or bare-metal clusters?▼

Yes, use opencost.customPricing with provider set to default and define your own CPU, RAM, and storage rates in the costModel. Document the basis for each rate, since a custom price without provenance is as unreliable as an unlabeled cost.