KubeHerodocs · v0.3.3

Chargeback

Attribute spend to teams, cost centers, namespaces and node pools with the labels you already use — in KubeHero, in Prometheus and in Grafana.

Chargeback is allocation grouped by who pays. KubeHero reads ownership from labels you already have, so there's no new configuration layer.

Labels

Label (default)MeaningOverride
kubehero.io/teamthe owning team — the primary chargeback axischargeback.teamLabel
kubehero.io/cost-centeran optional business unit / cost centerchargeback.costCenterLabel
node pool (auto-detected per cloud)eks.amazonaws.com/nodegroup, cloud.google.com/gke-nodepool, agentpoolchargeback.nodepoolLabel

Pods without a team label fall back to chargeback.namespaceToTeam (e.g. kube-system: platform), then to chargeback.defaultTeam (unattributed) — unallocated spend stays visible instead of disappearing.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: checkout-api
spec:
  template:
    metadata:
      labels:
        kubehero.io/team: payments
        kubehero.io/cost-center: commerce

In KubeHero

kubehero cost allocation --aggregate team --window month --idle --share-idle weighted
kubehero cost allocation --aggregate team,nodepool --window lastmonth
kubehero cost timeseries --group-by team --window 30d
kubehero cost export --format focus --window lastmonth --aggregate workload --file chargeback.csv

Team rows include CPU, RAM, GPU and network cost, log volume, idle cost shared back, and what rightsizing would recover — see Cost allocation. The dashboard's chargeback page shows the same by team and cost center, with a cloud split.

In Prometheus and Grafana

The collector exports per-pod kubehero_pod_cost_usd_per_second and kubehero_pod_recoverable_usd_per_second with team, cost_center, nodepool, cloud, region and gpu_kind labels. The chart's recording rules roll them up:

kubehero:team_cost_usd:rate1h        # $/hour per team
kubehero:team_cost_usd:rate30d       # projected 30-day spend per team
kubehero:nodepool_cost_usd:rate1h
kubehero:cost_center_cost_usd:rate1h
kubehero:team_gpu_idle_cost_usd:rate1h
kubehero:team_recoverable_usd:rate1h

With kube-prometheus-stack, the chart also ships Grafana dashboards — Chargeback by team, Fleet and GPU — as ConfigMaps picked up by the Grafana sidecar:

grafana:
  dashboards:
    chargeback: true
    fleet: true
    gpu: false

See Prometheus + Grafana and the metrics reference.

Budgets

Put a BudgetPolicy on a team's namespaces to get threshold alerts (50 / 80 / 95 / 100%) and, if you arm it, an escalation plan — see the CRD reference. The default Budget burn over 1.5× alert rule watches every BudgetPolicy (Alerting).

On this page