Skip to content

Commit 70df768

Browse files
authored
Merge pull request #268754 from kaysieyu/ky-cost-analysis-030524
AKS Cost Analysis addon docs update
2 parents 2d8d3e8 + e473c69 commit 70df768

File tree

1 file changed

+33
-43
lines changed

1 file changed

+33
-43
lines changed

articles/aks/cost-analysis.md

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,52 @@
11
---
2-
title: Azure Kubernetes Service cost analysis (preview)
2+
title: Azure Kubernetes Service cost analysis
33
description: Learn how to use cost analysis to surface granular cost allocation data for your Azure Kubernetes Service (AKS) cluster.
44
author: nickomang
55
ms.author: nickoman
66
ms.service: azure-kubernetes-service
77
ms.custom: ignite-2023, devx-track-azurecli
88
ms.topic: how-to
9-
ms.date: 11/06/2023
9+
ms.date: 03/15/2024
1010

1111
#CustomerIntent: As a cluster operator, I want to obtain cost management information, perform cost attribution, and improve my cluster footprint
1212
---
1313

14-
# Azure Kubernetes Service cost analysis (preview)
14+
# Azure Kubernetes Service cost analysis
1515

16-
An Azure Kubernetes Service (AKS) cluster is reliant on Azure resources like virtual machines, virtual disks, load-balancers and public IP addresses. These resources can be used by multiple applications, which could be maintained by several different teams within your organization. Resource consumption patterns of those applications are often nonuniform, and thus their contribution towards the total cluster resource cost is often nonuniform. Some applications can also have footprints across multiple clusters. This can pose a challenge when performing cost attribution and cost management.
16+
An Azure Kubernetes Service (AKS) cluster is reliant on Azure resources like virtual machines, virtual disks, load-balancers, and public IP addresses. Multiple applications can use these resources, which might be maintained by different teams within your organization. Resource consumption patterns for those applications are often variable, so their contribution towards the total cluster resource cost can also vary. Some applications can also have footprints across multiple clusters, which can pose a challenge when performing cost attribution and cost management.
1717

1818
Previously, [Microsoft Cost Management (MCM)](../cost-management-billing/cost-management-billing-overview.md) aggregated cluster resource consumption under the cluster resource group. You could use MCM to analyze costs, but there were several challenges:
1919

20-
* Costs were reported per cluster. There was no breakdown into discrete categories such as compute (including CPU cores and memory), storage, and networking.
20+
* There was no Azure-native capability to display cluster resource usage at a level more granular than a cluster. There was no breakdown into discrete categories such as compute (including CPU cores and memory), storage, and networking.
2121

22-
* There was no Azure-native functionality to distinguish between types of costs. For example, individual application versus shared costs. MCM reported the cost of resources, but there was no insight into how much of the resource cost was used to run individual applications, reserved for system processes required by the cluster, or idle cost associated with the cluster.
23-
24-
* There was no Azure-native capability to display cluster resource usage at a level more granular than a cluster.
22+
* There was no Azure-native functionality to distinguish between types of costs, for example between individual application costs and shared costs. MCM reported the cost of resources, but there was no insight into how much of the resource cost was used to run individual applications, how much was reserved for system processes required by the cluster, or what were the idle costs associated with the cluster.
2523

2624
* There was no Azure-native mechanism to analyze costs across multiple clusters in the same subscription scope.
2725

28-
As a result, you might have used third-party solutions, like Kubecost or OpenCost, to gather and analyze resource consumption and costs by Kubernetes-specific levels of granularity, such as by namespace or pod. Third-party solutions, however, require effort to deploy, fine-tune, and maintain for each AKS cluster. In some cases, you even need to pay for advance features, increasing the cluster's total cost of ownership.
29-
30-
To address this challenge, AKS has integrated with MCM to offer detailed cost drill down scoped to Kubernetes constructs, such as cluster and namespace, in addition to Azure Compute, Network, and Storage categories.
26+
As a result, you might have used third-party solutions to gather and analyze resource consumption and costs by Kubernetes-specific levels of granularity, such as by namespace or pod. Third-party solutions, however, require effort to deploy, fine-tune, and maintain for each AKS cluster. In some cases, you even need to pay for advanced features, increasing the cluster's total cost of ownership.
3127

32-
The AKS cost analysis addon is built on top of [OpenCost](https://www.opencost.io/), an open-source Cloud Native Computing Foundation Sandbox project for usage data collection, which gets reconciled with your Azure invoice data. Post-processed data is visible directly in the [MCM Cost Analysis portal experience](/azure/cost-management-billing/costs/quick-acm-cost-analysis).
28+
To address this challenge, AKS has integrated with MCM to offer detailed cost drill-down scoped to Kubernetes constructs, such as cluster and namespace, in addition to Azure Compute, Network, and Storage categories.
3329

34-
[!INCLUDE [preview features callout](./includes/preview/preview-callout.md)]
30+
The AKS cost analysis addon is built on top of [OpenCost](https://www.opencost.io/), an open-source Cloud Native Computing Foundation Sandbox project for usage data collection. The cost analysis is reconciled with your Azure invoice data. Post-processed data is visible directly in the [MCM Cost Analysis portal experience](/azure/cost-management-billing/costs/quick-acm-cost-analysis).
3531

3632
## Prerequisites and limitations
3733

3834
* Your cluster must be either `Standard` or `Premium` tier, not the `Free` tier.
3935

4036
* To view cost analysis information, you must have one of the following roles on the subscription hosting the cluster: Owner, Contributor, Reader, Cost management contributor, or Cost management reader.
4137

42-
* Once cost analysis has been enabled, you can't downgrade your cluster to the `Free` tier without first disabling cost analysis.
38+
* Once you have enabled cost analysis, you can't downgrade your cluster to the `Free` tier without first disabling cost analysis.
4339

4440
* Your cluster must be deployed with a [Microsoft Entra Workload ID](./workload-identity-overview.md) configured.
4541

4642
* If using the Azure CLI, you must have version `2.44.0` or later installed, and the `aks-preview` Azure CLI extension version `0.5.155` or later installed.
4743

48-
* The `ClusterCostAnalysis` feature flag must be registered on your subscription.
49-
5044
* Kubernetes cost views are available only for the following Microsoft Azure Offer types. For more information on offer types, see [Supported Microsoft Azure offers](/azure/cost-management-billing/costs/understand-cost-mgt-data#supported-microsoft-azure-offers).
5145
* Enterprise Agreement
5246
* Microsoft Customer Agreement
5347

48+
* Virtual nodes aren't supported at this time.
49+
5450

5551
### Install or update the `aks-preview` Azure CLI extension
5652

@@ -66,31 +62,11 @@ If you need to update the extension version, you can do this using the [`az exte
6662
az extension update --name aks-preview
6763
```
6864

69-
### Register the 'ClusterCostAnalysis' feature flag
70-
71-
Register the `ClusterCostAnalysis` feature flag by using the [az feature register][az-feature-register] command, as shown in the following example:
72-
73-
```azurecli-interactive
74-
az feature register --namespace "Microsoft.ContainerService" --name "ClusterCostAnalysis"
75-
```
76-
77-
It takes a few minutes for the status to show *Registered*. Verify the registration status by using the [az feature show][az-feature-show] command:
78-
79-
```azurecli-interactive
80-
az feature show --namespace "Microsoft.ContainerService" --name "ClusterCostAnalysis"
81-
```
82-
83-
When the status reflects *Registered*, refresh the registration of the *Microsoft.ContainerService* resource provider by using the [az provider register][az-provider-register] command:
84-
85-
```azurecli-interactive
86-
az provider register --namespace Microsoft.ContainerService
87-
```
88-
8965
## Enable cost analysis on your AKS cluster
9066

9167
Cost analysis can be enabled during one of the following operations:
9268

93-
* Create a `Standard` or `Premium` tier AKS cluster
69+
* Create a `Standard` or `Premium` tier AKS cluster.
9470

9571
* Update an AKS cluster that is already in `Standard` or `Premium` tier.
9672

@@ -100,12 +76,15 @@ Cost analysis can be enabled during one of the following operations:
10076

10177
* Downgrade a `Premium` cluster to `Standard` tier.
10278

103-
To enable the feature, use the flag `--enable-cost-analysis` in combination with one of these operations. For example, the following command will create a new AKS cluster in the `Standard` tier with cost analysis enabled:
79+
To enable the feature, use the flag `--enable-cost-analysis` in combination with one of these operations. For example, the following command creates a new AKS cluster in the `Standard` tier with cost analysis enabled:
10480

10581
```azurecli-interactive
10682
az aks create --resource-group <resource_group> --name <name> --location <location> --enable-managed-identity --generate-ssh-keys --tier standard --enable-cost-analysis
10783
```
10884

85+
> [!WARNING]
86+
> The AKS cost analysis addon Memory usage is dependent on the number of containers deployed. Memory consumption can be roughly approximated by 200MB + 0.5MB per Container. The current memory limit is set to 4GB which will support approximately 7000 containers per cluster but could be more or less depending on various factors. These estimates are subject to change.
87+
10988
## Disable cost analysis
11089

11190
You can disable cost analysis at any time using `az aks update`.
@@ -117,19 +96,30 @@ az aks update --name myAKSCluster --resource-group myResourceGroup --disable-cos
11796
> [!NOTE]
11897
> If you intend to downgrade your cluster from the `Standard` or `Premium` tiers to the `Free` tier while cost analysis is enabled, you must first explicitly disable cost analysis as shown here.
11998
120-
## View cost information
99+
## View the cost data
121100

122-
You can view cost allocation data in the Azure portal. To learn more about how to navigate the cost analysis UI view, see the [Cost Management documentation](/azure/cost-management-billing/costs/view-kubernetes-costs).
101+
You can view cost allocation data in the Azure portal. To learn more about how to navigate the cost analysis UI view, see the [Cost Management documentation](/azure/cost-management-billing/costs/view-kubernetes-costs).
102+
103+
### Cost definitions
104+
105+
In the Kubernetes namespaces and assets views you'll see the following charges:
106+
107+
- **Idle charges**: Represents the cost of available resource capacity that wasn't used by any workloads.
108+
- **Service charges**: Represents the charges associated with the service like Uptime SLA, Microsoft Defender for Containers etc.
109+
- **System charges**: Represents the cost of capacity reserved by AKS on each node to run system processes required by the cluster, including the kubelet and container runtime. [Learn more](./concepts-clusters-workloads.md#resource-reservations).
110+
- **Unallocated charges**: Represents the cost of resources that couldn't be allocated to namespaces.
123111

124112
> [!NOTE]
125-
> It might take up to one day for data to finalize
113+
> It might take up to one day for data to finalize. After 24 hours, any fluctuations in costs for the previous day will have stabilized.
126114
127115
## Troubleshooting
128116

129117
See the following guide to troubleshoot [AKS cost analysis add-on issues](/troubleshoot/azure/azure-kubernetes/aks-cost-analysis-add-on-issues).
130118

131119
<!-- LINKS -->
132120
[az-extension-add]: /cli/azure/extension#az-extension-add
133-
[az-feature-register]: /cli/azure/feature#az_feature_register
134-
[az-feature-show]: /cli/azure/feature#az_feature_show
135121
[az-extension-update]: /cli/azure/extension#az-extension-update
122+
123+
## Learn more
124+
125+
Visibility is one element of cost management. Refer to [Optimize Costs in Azure Kubernetes Service (AKS)](./best-practices-cost.md) for other best practices on how to gain control over your kubernetes cost.

0 commit comments

Comments
 (0)