All Products
Search
Document Center

Container Service for Kubernetes:Enable cost insights

Last Updated:Dec 29, 2025

The cost insights feature helps you understand cluster resource usage and cost distribution across multiple dimensions. It also provides suggestions to help you save costs.

Prerequisites

Billing

  • Cost insights generates basic metrics from data such as bills and cloud resource prices, and reports the metrics to Managed Service for Prometheus. If you change the default settings, such as the default storage duration, you may incur additional costs. For more information, see Billing of Managed Service for Prometheus.

  • The cost allocation tags feature filters ACK cost insights data by default. To ensure that ACK cost insights can retrieve bill and node pool analysis data, enable the cost allocation tags feature, and then enable the ack.aliyun.com and ack.alibabacloud.com/nodepool-id tags.

Enable cost insights

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

  2. On the Clusters page, find the cluster you want and click its name. In the left navigation pane, choose Cost Suite > Cost Insights.

  3. Grant the AliyunCSManagedCostRole role and install the ack-cost-exporter component to enable cost insights.

    1. Grant permissions to access ACK cluster bill data

      • ACK managed cluster: The system automatically grants the required permissions. After authorization, the system creates the AliyunCSManagedCostRole role. Managed Service for Prometheus uses this role to access your bill data in Expenses and Costs and perform cost analysis.

        You can also click the quick authorization link. On the Quick Authorization page, click Confirm Authorization.

      • ACK dedicated cluster:

        Expand to view the authorization steps

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

        2. On the RAM role page, click the Permission Management tab. In the Access Policy column, click k8sWorkerRole****.

        3. On the access policy details page, click the Policy Content tab, and then click Modify Policy Content.

        4. In the script editor, add the following authorization rules to the Statement field. After you modify the policy, click Edit Basic Information and then click Confirm.

                  {
                      "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

          Multiple policy statements must be separated by commas (,).

    2. Install the component

      Follow the instructions on the page to install the ack-cost-exporter component. After the installation is complete, you are automatically redirected to the Cost Insights page.

Disable cost insights

If you no longer need the cost insights feature, you can uninstall the ack-cost-exporter component to disable the feature.

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

  2. On the Clusters page, find the one you want to manage and click its name. In the left navigation pane, click Add-ons.

  3. On the Component Management page, find ack-cost-exporter and click Uninstall on its card. In the Uninstall Component dialog box, click Confirm.

FAQ

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

  • If the ack-cost-exporter component fails to install, run the following commands to manually delete the component. Then, install the ack-cost-exporter component again. For more information about how to install the component, see Manage components.

    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
    
    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
    
    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 ack-cost-exporter component fails to uninstall, run the following commands to manually delete the component.

    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
    
    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
    
    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