Kubernetes cost allocation by team works in four steps: define the full cluster cost, give every namespace a team label, choose an allocation basis, and report idle capacity, system reserve and shared services as lines of their own. The check is simple: team costs plus the shared lines add back up to the cluster cost on the cloud bill. This guide covers the method; Understand Kubernetes cluster cost without per-pod guesses explains how node cost is technically spread across namespaces.
What belongs to the cluster cost
The OpenCost specification, a vendor-neutral standard for Kubernetes cost, separates two blocks. Cluster asset costs are directly observable resources: nodes, persistent volumes, attached disks, load balancers and network traffic. Cluster overhead costs come from operating the cluster itself, such as management fees. Asset costs in turn split into workload costs and idle costs, which together add up exactly to the asset costs.
Before allocating anything, decide which bill lines belong to a cluster: node groups or node pools, the disks behind persistent volumes, the ingress load balancers and the cluster fee. Managed databases, object storage or queues outside the cluster do not. They follow your cloud account's tags, as described in Enforce tagging in AWS and Azure. A team therefore has cluster cost and direct cloud cost, and both belong in its report without the lines overlapping.
The convention: namespace as the unit, label as the key
For small teams the namespace is the most robust allocation unit. Give every namespace a team label and keep a table outside the cluster that maps each team to a cost centre. A cost centre change then edits one table row instead of many manifests, and no personal names end up in the cluster.
| Situation | Allocation key | Note |
|---|---|---|
| One team owns a namespace | namespace label team | default case |
| Several teams share a namespace | pod label team in the pod template | only here, otherwise maintained twice |
| Platform services such as ingress, monitoring, kube-system | team=platform, flagged as shared | allocated by a rule, see below |
Namespace without team | none | report as unallocated and find the owner |
Keep the label count small. If a pod has more than 50 labels, GKE passes none of them to billing.
Require the label with a ValidatingAdmissionPolicy
ValidatingAdmissionPolicy has been stable since Kubernetes 1.30 and needs no extra controller. This policy requires a team label on every new or updated namespace, except system namespaces prefixed kube-:
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicy
metadata:
name: require-team-label
spec:
failurePolicy: Fail
matchConstraints:
resourceRules:
- apiGroups: [""]
apiVersions: ["v1"]
operations: ["CREATE", "UPDATE"]
resources: ["namespaces"]
validations:
- expression: >-
object.metadata.name.startsWith('kube-') ||
(has(object.metadata.labels) && 'team' in object.metadata.labels)
message: "Namespace needs a team label."
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicyBinding
metadata:
name: require-team-label
spec:
policyName: require-team-label
validationActions: [Warn, Audit]
Start with [Warn, Audit]: violations show as a client warning and in the audit log but block nothing. Find existing namespaces without the label with kubectl get namespaces -l '!team' and add it. Only then switch to [Deny], because the policy also fires on UPDATE and would block changes to unlabelled namespaces. The documentation does not allow Deny and Warn together.
Requests or usage as the allocation basis
| Basis | What it reflects | Who uses it |
|---|---|---|
| Requests | reserved capacity the scheduler holds | GKE cost allocation; AWS split cost allocation with the "Resource requests" option |
| max(request, usage) | reserved capacity plus consumption above the request | OpenCost specification; AWS with the "Amazon Managed Service for Prometheus" option |
| Usage only | actual consumption | unsuitable for reserved capacity, because over-requesting costs nothing |
For team accountability, max(request, usage) fits best: a team pays for the capacity it blocks and for anything it consumes beyond that. One edge case needs attention. Under purely request-based allocation, pods without requests receive no cost, and AWS states this explicitly for the "Resource requests" option. Require requests on every container, or their consumption drifts silently into idle.
Idle, system reserve and shared services
Three cost blocks belong to no single team:
- Idle is capacity no workload occupies. Providers draw the line differently: GKE counts unrequested capacity as the namespace
kube:unallocated, AKS reports unused capacity as "Idle charges", and AWS shows it in the columnsplit_line_item_unused_cost. - System reserve is node capacity held for the kubelet and container runtime. GKE calls it
kube:system-overhead, AKS "System charges". - Shared services and overhead cover ingress controllers, monitoring, kube-system and the cluster fee. AKS lists fees such as the Uptime SLA as "Service charges".
The OpenCost specification names three common ways to distribute such cost: uniformly across tenants, in proportion to each tenant's asset cost, or by a custom metric such as egress bytes. A workable rule: spread shared services in proportion to direct team cost, and keep idle and system reserve as a platform team line, because only that team decides node sizes, autoscaler minimums and headroom. Idle pushed onto teams becomes cost no team can reduce.
AWS already applies unused cost to pods in proportion to split usage. Adding split_line_item_split_cost and split_line_item_unused_cost therefore distributes idle; using only the first column keeps it as a visible residual. Write the choice down and flag any later change instead of rewriting past months silently.
What AWS, Google Cloud and Azure provide
| Provider | Feature and activation | Team key in the data | Limits |
|---|---|---|---|
| AWS (EKS) | Split cost allocation data, under "Cost Management preferences" in the payer or standalone account | tags aws:eks:namespace, aws:eks:workload-name | CUR and CUR 2.0 only, not Cost Explorer; up to 24 hours |
| Google Cloud (GKE) | GKE cost allocation, gcloud container clusters update {cluster} --enable-cost-allocation | labels k8s-namespace, k8s-label/{key} in the BigQuery export | request-based; up to three days; no backfill |
| Azure (AKS) | OpenCost-based cost analysis add-on, az aks update --enable-cost-analysis | namespace view in Cost analysis | Standard or Premium tier only; EA and MCA only |
The three calculate differently and are not directly comparable across clouds. The GKE labels sit in the detailed export, covered in Set up Google Cloud billing export for cost reporting.
A showback table that reconciles to the bill
| Line | Source | Rule |
|---|---|---|
| Team checkout | namespaces with team=checkout | max(request, usage) × resource price |
| Team search | namespaces with team=search | as above |
| Shared services | team=platform, flagged as shared | spread across team lines in proportion to direct cost |
| Idle | capacity neither requested nor used | platform team, capacity decision |
| System reserve and cluster fee | system reserve, control plane | platform budget |
| Unallocated | namespaces without team | keep visible, find the owner before the next review |
| Total | all lines | equals the cluster cost on the bill |
Check the total every month. If it does not match, a cost block is usually missing from the cluster definition, or node cost is counted twice, once from the cloud bill and once from the Kubernetes view. Allocating shared costs in multi-tenant SaaS applies the same principle outside Kubernetes, and the glossary defines shared cost.
Where Costfluent fits
Costfluent's Kubernetes integration is available; the docs explain the setup under connecting Kubernetes. An agent installed with Helm reports resource requests, usage and allowed pod labels; it sends namespace labels only when agent.collectNamespaceLabels is enabled. Costfluent distributes node cost across namespaces and shows idle as its own line; it does not allocate cost to individual pods. Costs are processed nightly, and unpriced nodes are reported as unpriced. Filter reports to cloud billing or Kubernetes so nodes are not counted twice. Cost allocation explains the terms segment, rule and unallocated residual.
Sources and method
Checked on 2026-10-10. OpenCost specification and its source text; AWS Data Exports, Understanding split cost allocation data, Enabling split cost allocation data and Split line item details; Google Cloud, Get key spending insights for your GKE resource allocation and cluster costs; Microsoft Learn, AKS cost analysis; Kubernetes, Validating Admission Policy and Labels and Selectors; for Costfluent, the Kubernetes integration page and the Helm chart values. The tables, policy and allocation rules are Costfluent recommendations for a showback view, not a cost accounting standard; agree any internal recharge with your finance team.



