All Products
Search
Document Center

Container Service for Kubernetes:Enable the cost analysis feature

Last Updated:Feb 28, 2026

The cost insights feature of Container Service for Kubernetes (ACK) helps you analyze resource usage and allocate costs across namespaces, node pools, and applications. It also identifies savings opportunities based on your cluster spending.

Cost dimensions

After you enable cost insights, you can analyze costs by:

  • Cluster

  • Namespace

  • Node pool

  • Application (Deployment, StatefulSet, DaemonSet, Job, CronJob)

Prerequisites

Before you begin, make sure that you have:

Billing

Cost insights metrics

Cost insights generates metrics from your billing data and cloud resource pricing, then reports them to Managed Service for Prometheus. Changing default settings such as storage retention periods may incur additional costs.

Cost allocation tags

Cost insights uses cost allocation tags to filter billing data and correlate it with node pool analytics. Configure these tags before you enable the feature:

  1. Go to the Expenses and Costs console.

  2. On the Cost allocation tags page, select the tags you want to enable from the left panel, move them to the Selected Tags area, and click Enable.

  3. Enable the following tags:

    • ack.aliyun.com

    • ack.alibabacloud.com/nodepool-id

Enable cost insights

  1. Log on to the Container Service Management Console . In the navigation pane on the left, click Clusters.

  2. On the Clusters page, click the name of your cluster. In the navigation pane on the left, click Cost Suite > Cost Insights.

  3. Authorize your cluster to access billing data.

    The authorization process differs by cluster type:

    1. Grant permission to access billing data

      • ACK managed clusters

        The system automatically grants the required permissions and creates the AliyunCSManagedCostRole Resource Access Management (RAM) role. Managed Service for Prometheus assumes this role to access your billing data in Expenses and Costs.

        Alternatively, authorize directly from the RAM Quick Authorization page.

      • ACK dedicated clusters

        Manually add billing permissions to the worker role policy:

        View the authorization steps

        1. On the Cost Insights page, click KubernetesWorkerRole-***.

        2. On the Permissions tab, click k8sWorkerRole**** in the Policy column.

        3. On the Policy Document tab, click Edit Policy Document.

        4. Add the following statements to the Statement array, then click OK.

          {
              "Action": [
                  "bssapi:QueryInstanceBill",
                  "bssapi:DescribeInstanceBill"
              ],
              "Resource": "*",
              "Effect": "Allow"
          },
          {
              "Action": [
                  "ecs:DescribeDisks",
                  "ecs:DescribeSpotPriceHistory",
                  "ecs:DescribeInstances",
                  "ecs:DescribePrice"
              ],
              "Resource": "*",
              "Effect": "Allow"
          },
          {
              "Action": [
                  "eci:DescribeContainerGroupPrice"
              ],
              "Resource": "*",
              "Effect": "Allow"
          }
          Note

          Separate each statement with a comma when adding multiple entries.

    2. Install the ack-cost-exporter component by following the on-screen instructions.

      After installation, the page redirects to Cost Insights automatically.

Disable cost insights

To stop collecting cost metrics, uninstall the ack-cost-exporter component:

  1. Log on to the Container Service Management Console . In the navigation pane on the left, click Clusters.

  2. On the Clusters page, click the name of your cluster. In the navigation pane on the left, click Add-ons.

  3. On the Add-ons page, find ack-cost-exporter and click Uninstall. In the confirmation dialog, click OK.

FAQ

What do I do if ack-cost-exporter fails to install or uninstall?

Delete the leftover resources manually, then retry the operation. Run the following commands against your cluster:

# Delete the Deployment and Services
kubectl delete deployment ack-cost-exporter -n kube-system
kubectl delete service alibaba-cloud-price-exporter -n kube-system
kubectl delete service alibaba-cloud-billing-exporter -n kube-system
kubectl delete service alibaba-cloud-cost-exporter -n kube-system

# Delete ServiceMonitors
kubectl delete ServiceMonitor alibaba-cloud-price-exporter -n kube-system
kubectl delete ServiceMonitor alibaba-cloud-billing-exporter -n kube-system
kubectl delete ServiceMonitor alibaba-cloud-cost-exporter -n kube-system

# Delete RBAC resources
kubectl delete ClusterRoleBinding ack-cost-exporter-cluster-role-binding
kubectl delete ClusterRoleBinding ack-cost-exporter-cluster-role-binding-v1
kubectl delete ServiceAccount ack-cost-exporter -n kube-system
kubectl delete ClusterRole ack-cost-exporter-cluster-role

If the install failed, reinstall ack-cost-exporter after cleaning up. For details, see Manage components.