kubecost allocations all show $0.00 - needs at least one prometheus scrape cycle before data appears
Fixes Kubecost allocation views that show zero cost for every workload. Covers waiting out the first scrape cycle, verifying Prometheus targets, and checking the cost model config. Use when a fresh install shows $0.00 everywhere. Not for wrong but nonzero numbers.
TL;DR
Kubecost needs at least one full Prometheus scrape cycle plus its own aggregation pass before allocations appear, so a fresh install showing $0.00 everywhere is usually just impatience. Wait 10 to 15 minutes, confirm the Prometheus targets are up, and check that the cluster has the node pricing it needs.
Use this when
- The Allocations page shows $0.00 for every namespace and workload.
- Kubecost was installed less than an hour ago.
- The bundled Prometheus shows targets up but allocations are empty.
Not for this skill when
- Allocations show values that look wrong. That is a pricing or label problem.
- Only some workloads are zero. Check their labels and the aggregation window.
Steps
- Wait 10 to 15 minutes after install, then hard-refresh the Allocations page. Verify: the window selector covers a period after the install time.
- Check the bundled Prometheus targets: port-forward to Prometheus and open the targets page. Verify: kubernetes-nodes, kube-state-metrics, and cadvisor targets are UP.
- Confirm cost-model can reach Prometheus: check the cost-analyzer logs for scrape or query errors. Verify: no connection errors in the last 15 minutes.
- Check node pricing is set: in Settings, confirm the provider integration or custom pricing has CPU and RAM rates. Verify: the Assets page shows nonzero node costs.
- If still zero after 30 minutes, restart the cost-analyzer pod to force a fresh aggregation pass. Verify: allocations populate within the next cycle.
External Prometheus variant
If Kubecost points at an existing Prometheus, confirm the required recording rules and metric retention are present. Verify: the Prometheus datasource test in Kubecost settings succeeds.
Compatibility: Kubecost (OpenCost-based) on any Kubernetes 1.24 and later.
Why it happens
Allocations are derived from time-series metrics, not point-in-time state. Until Prometheus has scraped a full cycle and Kubecost has run its ETL over that window, there is literally no data to allocate, and the UI renders that as $0.00.
Edge cases / pitfalls
- An aggregation window ending before the install time always shows zero. Extend the window forward.
- Short Prometheus retention starves longer allocation windows; align the two.
- Thanos or remote-write setups can delay metric availability by several minutes.
- Idle clusters with no running workloads show real zeros. Check that pods are actually scheduled.
Provenance
Resolved from the public thread: https://vectle.com/posts/pstCBLXslGyCF-XyZ3ohNOnQ