Costfluent Docs
  • Pricing
  • Changelog
  • costfluent.com
  • Documentation
  • Guides
  • API Reference
Product
  • Pricing
  • Security
  • Changelog
Developers
  • API reference
  • Terraform
  • llms.txt
Legal
  • Privacy
  • Terms
  • Imprint
Showback for teamsBudget routineCost reporting for an AWS OrganizationTrack OpenAI and Anthropic API spendReport multi-cloud cost in eurosKubernetes cost by namespace and team
Guides

Kubernetes cost by namespace and team

Send the labels the agent needs, turn them into one team tag, assign namespaces to segments, and report cost per namespace and team.

A cluster's bill names nodes, not the teams that run workloads on them. This guide installs the agent with the labels that name teams, turns those labels into one tag, assigns each namespace to a segment, and reports cost per namespace and team. Each step links to the page that owns the detail.

Before you start

  • A cluster to install the agent on, and the AWS, Azure or Google Cloud connection that pays for its nodes, or the rates to price them by; see Connect Kubernetes.
  • The label that names a team on your pods or namespaces, such as team, and the namespaces that carry none.
  • The Owner or Editor team role in the workspace; see Access model.

1. Send the labels

Install the agent with agent.allowedLabels naming the pod labels to send, or empty for all of them, and agent.collectNamespaceLabels=true when the team label sits on the namespace. Each label reaches reports as a tag named k8s:label:<key>, and every row also carries k8s:cluster, k8s:namespace, k8s:node and k8s:pod. Cost appears the morning after the install. See Install the agent and Reporting dimensions.

2. Make one team tag

Create a virtual tag team whose provider tag keys read k8s:label:team first and your other spellings after it, and add a rule for each namespace that carries no label, with a Namespace condition and the team as its value. Check the preview until "Unmatched" is small. See Virtual tags.

3. Assign namespaces to segments

Add one segment per team and one rule per segment: a rule cannot read a virtual tag, so give it a Namespace condition naming the team's namespaces, or a Tag condition on k8s:label:team. Idle cost sits in the namespace __idle__; a rule can assign it to a platform segment, or you leave it unallocated to keep it visible. See Segments and allocation rules.

4. Report per namespace and team

Group by Namespace for the allocation, or by Virtual tag team for the teams, and add Cluster when there are several. A cluster's rows count only when a report asks for Kubernetes, by a grouping or filter on provider, cluster, namespace or a k8s: tag, so a report grouped by Segment alone leaves them out: add Namespace as a second grouping, or filter Provider to Kubernetes. See How totals count a cluster and Explore cost data.

5. Deliver it

Save the report, and for each team a copy filtered by Virtual tag to its value, and schedule each weekly to the team. See Save and manage reports and Share and schedule reports.

Keep it true

  • A new namespace appears under Namespace with its first processed day, and under "Unmatched" until a label or a rule names its team.
  • A node without a price is counted as unpriced on the cluster and appears in no namespace; the cluster's status says so. See How costs are calculated.

Related

  • Showback for teams
Report multi-cloud cost in euros
On this page
  • Before you start
  • 1. Send the labels
  • 2. Make one team tag
  • 3. Assign namespaces to segments
  • 4. Report per namespace and team
  • 5. Deliver it
  • Keep it true
  • Related