> ## Documentation Index
> Fetch the complete documentation index at: https://docs.costory.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Kubernetes Cost Allocation

> Allocate EKS, GKE and AKS costs by cluster, namespace, label and team. EKS, GKE and AKS are read from your cloud billing export, with no Costory agent in the cluster.

## How Costory reads Kubernetes cost

| Cluster | How Costory gets the cost | Agent in the cluster |
| - | - | - |
| EKS | AWS Split Cost Allocation Data in your CUR 2.0 export, with Kubernetes labels | No |
| GKE | GKE cost allocation labels in your Google Cloud billing export | No |
| AKS | The AKS cost analysis add-on (enabled in Azure), on your Azure Cost Management export. See [AKS cost allocation](https://docs.costory.io/setup/billing/azure.md#aks-cost-allocation). | No |

Kubernetes cost lands in the same cost model as your other providers. You can split it by cluster, namespace, label and team.

## EKS

1. Connect AWS billing first ([AWS Billing Setup](https://docs.costory.io/setup/billing/aws.md)).
2. In AWS Billing preferences, turn on **Split cost allocation data** for Amazon EKS, and import the Kubernetes labels you want to allocate by (for example `team`, `app`).
3. Costory's CloudFormation and Terraform templates already include split cost allocation data in the CUR 2.0 export. If you created the export by hand, check that it's included.

To add labels to your pod deployments, see the [EKS cost allocation](https://docs.costory.io/use-cases/eks-cost-allocation.md) guide.

## GKE

1. Connect Google Cloud billing first ([GCP Billing Setup](https://docs.costory.io/setup/billing/gcp.md)), with the detailed usage cost export.
2. In the GKE cluster settings, turn on **GKE cost allocation**, so namespace and label data lands in the billing export.

Google exposes labels in the billing export with the prefix `k8s_label_<label_name>` (see [GKE cost allocations](https://cloud.google.com/kubernetes-engine/docs/how-to/cost-allocations)). They show up directly in Costory Dimensions, with no extra setup.

## AKS

1. Connect Azure billing first ([Azure Billing Setup](https://docs.costory.io/setup/billing/azure.md)).
2. Check that the cluster is on the **Standard** or **Premium** tier, under an **Enterprise Agreement** or a **Microsoft Customer Agreement**. The Free tier does not support cost analysis.
3. Enable the **cost analysis** add-on on each cluster, with the Azure CLI (`az aks update --enable-cost-analysis`), in the Azure portal (**Settings** > **Cost analysis**) or with Terraform (`cost_analysis_enabled = true`). Azure does not inherit the setting from a subscription, so repeat it on every cluster.

Costory then splits AKS cost by namespace, workload, and any `label_*` keys in the cost-analysis export.

For requirements and details, see [AKS cost allocation](https://docs.costory.io/setup/billing/azure.md#aks-cost-allocation).

## Good to know

* Cluster cost is shared. A fair split by namespace needs usage metrics (CPU and memory requests or usage), not only node tags.
* To split a shared cluster by real usage, see [EKS cost allocation](https://docs.costory.io/use-cases/eks-cost-allocation.md). It covers reallocation with Datadog usage.
* To measure Kubernetes waste and reallocate it to teams, see [Kubernetes cost visibility](https://docs.costory.io/use-cases/k8s_waste/visibility.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.