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.

Cluster cost on the cloud bill: node groups, the disks behindpersistent volumes, ingress load balancers, the cluster feeAsset costs: nodes, volumes,disks, load balancers, networkOverhead: management feesWorkload costs, by namespacewith a team labelIdle: capacity noworkload occupiesA team's report: its cluster cost plus its directcloud cost from account tags, without overlapping lines
Cluster cost, decomposed the OpenCost way: asset costs split into workload and idle, overhead stands apart, and a team's report adds its direct cloud cost without overlap

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.

SituationAllocation keyNote
One team owns a namespacenamespace label teamdefault case
Several teams share a namespacepod label team in the pod templateonly here, otherwise maintained twice
Platform services such as ingress, monitoring, kube-systemteam=platform, flagged as sharedallocated by a rule, see below
Namespace without teamnonereport 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.

Bind the policy with Warn and Audit: violations showas client warnings and in the audit log, nothing blocksFind the namespaces without the label:kubectl get namespaces -l '!team'Add the team label to each, and itscost centre to the table outside the clusterSwitch to Deny: a namespace without a team labelis no longer created or updated, kube- prefixes excepted
From warning to denial: the policy is bound in Warn and Audit first, the unlabelled namespaces are found and labelled, and only then does Deny block a namespace without a team label

Requests or usage as the allocation basis

BasisWhat it reflectsWho uses it
Requestsreserved capacity the scheduler holdsGKE cost allocation; AWS split cost allocation with the "Resource requests" option
max(request, usage)reserved capacity plus consumption above the requestOpenCost specification; AWS with the "Amazon Managed Service for Prometheus" option
Usage onlyactual consumptionunsuitable 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 column split_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

ProviderFeature and activationTeam key in the dataLimits
AWS (EKS)Split cost allocation data, under "Cost Management preferences" in the payer or standalone accounttags aws:eks:namespace, aws:eks:workload-nameCUR 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-allocationlabels k8s-namespace, k8s-label/{key} in the BigQuery exportrequest-based; up to three days; no backfill
Azure (AKS)OpenCost-based cost analysis add-on, az aks update --enable-cost-analysisnamespace view in Cost analysisStandard 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

LineSourceRule
Team checkoutnamespaces with team=checkoutmax(request, usage) × resource price
Team searchnamespaces with team=searchas above
Shared servicesteam=platform, flagged as sharedspread across team lines in proportion to direct cost
Idlecapacity neither requested nor usedplatform team, capacity decision
System reserve and cluster feesystem reserve, control planeplatform budget
Unallocatednamespaces without teamkeep visible, find the owner before the next review
Totalall linesequals 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.