Enable cost insights
The cost insights feature helps you analyze resource usage and cost distribution across multiple dimensions. It also provides recommendations for cost savings.
Prerequisites
You have an ACS cluster that runs Kubernetes version 1.26 or later and has public access enabled.
You have enabled Managed Service for Prometheus for the cluster. For more information, see Monitor an ACS cluster with Managed Service for Prometheus.
Billing
The cost insights feature generates basic metrics based on data such as your bills and cloud resource prices, and reports these metrics to Managed Service for Prometheus. If you change the default settings, such as the default retention period, you may incur additional fees.
The cost allocation tags feature filters cost insights data by default. You must enable the cost allocation tags feature in Expenses and Costs, and then activate the
ack.aliyun.comandacs:acc:cluster_idtags. Otherwise, the cost insights feature cannot retrieve billing data.When you enable cost insights, ack-cost-exporter Pods are created in your cluster. The component itself is free of charge, but the Pods consume cluster resources and are billed based on ACS Pod resource usage. For more information, see ACS container compute costs.
Enable cost insights
-
Log on to the ACS console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of the target cluster. In the left navigation pane, choose .
Click Authorize. The system automatically grants the required permissions. After authorization is complete, the system creates the AliyunCCManagedCostRole role. Managed Service for Prometheus uses this role to access your billing data in Expenses and Costs and generate cost insights.
Alternatively, you can click the RAM Quick Authorization link. On the RAM Quick Authorization page, click Authorize.
Install the component.
Follow the on-screen instructions to install the ack-cost-exporter component. After installation, the system automatically redirects you to the Cost Insights page.
Disable cost insights
If you no longer need the cost insights feature, you can disable it by uninstalling the ack-cost-exporter component.
-
Log on to the ACS console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of the target cluster. In the left navigation pane, click Add-ons.
On the Add-ons page, find ack-cost-exporter and click Uninstall on its card. In the Confirm dialog box, click OK.
FAQ
Troubleshoot ack-cost-exporter installation or uninstallation failures
If the ack-cost-exporter component fails to install or uninstall, manually delete it by running the following commands. Then, reinstall the component. For more information about installing the ack-cost-exporter 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