AKS Cost Analysis add-on issues

This article discusses how to troubleshoot problems that you might experience when you enable the Microsoft Azure Kubernetes Service (AKS) Cost Analysis add-on during cluster creation or a cluster update.

Prerequisites

Symptoms

After you create or update an AKS cluster, you receive an error message in the following format:

Error code Cause
InvalidDiskCSISettingForCostAnalysis Cause 1: Azure Disk CSI driver is disabled
InvalidManagedIdentitySettingForCostAnalysis Cause 2: Managed identity is disabled
CostAnalysisNotEnabledInRegion Cause 3: The add-on is unavailable in your region
InvalidManagedClusterSKUForFeature Cause 4: The add-on is unavailable on the free pricing tier
Pod OOMKilled Cause 5: The cost-analysis-agent pod gets the OOMKilled error
Pod Pending Cause 6:The cost-analysis-agent pod is stuck in the Pending state

Cause 1: Azure Disk CSI driver is disabled

You can't enable the Cost Analysis add-on on a cluster in which the Azure Disk Container Storage Interface (CSI) driver is disabled.

Solution: Update the cluster to enable the Azure Disk CSI driver

Run the az aks update command, and specify the --enable-disk-driver parameter. This parameter enables the Azure Disk CSI driver in AKS.

az aks update --resource-group <my-resource-group> --name <my-aks-cluster> --enable-disk-driver

For more information, see CSI drivers on AKS.

Cause 2: Managed identity is disabled

You can enable the Cost Analysis add-on only on a cluster that has a system-assigned or user-assigned managed identity.

Solution: Update the cluster to enable managed identity

Run the az aks update command, and specify the --enable-managed-identity parameter:

az aks update --resource-group <my-resource-group> --name <my-aks-cluster> --enable-managed-identity

For more information, see Use a managed identity in AKS.

Cause 3: The add-on is unavailable in your region

The Cost Analysis add-on isn't currently enabled in your region.

Note

The AKS Cost Analysis add-on is currently unavailable in the following regions:

  • usnateast
  • usnatwest
  • usseceast
  • ussecwest

Cause 4: The add-on is unavailable on the free pricing tier

You can't enable the Cost Analysis add-on on AKS clusters that are on the free pricing tier.

Solution: Update the cluster to use the Standard or Premium pricing tier

Upgrade the AKS cluster to the Standard or Premium pricing tier. To do this, run one of the following az aks update commands that specify the --tier parameter:

az aks update --resource-group <my-resource-group> --name <my-aks-cluster> --tier standard
az aks update --resource-group <my-resource-group> --name <my-aks-cluster> --tier premium

For more information, see Free and Standard pricing tiers for AKS cluster management.

Cause 5: The cost-analysis-agent pod gets the OOMKilled error

The current memory limit for the cost-analysis-agent pod is set to 4 GB.

The pod's usage depends on the number of deployed containers, which can be roughly 200 MB + 0.5 MB per container. The current memory limit supports approximately 7000 containers per cluster.

When the pod's usage exceeds the allocated 4 GB limit, large clusters may experience the OOMKill error.

Solution: Disable the add-on

Currently, customizing or manually increasing memory limits for the add-on isn't supported. To resolve this issue, disable the add-on.

Cause 6: The cost-analysis-agent pod is stuck in the Pending state

If the pod is stuck in the Pending state with the FailedScheduling error, the nodes in the cluster have exhausted memory capacity.

Solution: Ensure there's sufficient allocatable memory

The current memory request of the cost-analysis-agent pod is set to 500 MB. Ensure that there's sufficient allocatable memory for the pod to be scheduled.

Contact us for help

If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.