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
You have an ACK cluster that runs Kubernetes 1.18.8 or later. To upgrade the cluster, see Manually upgrade a cluster.
You have enabled Managed Service for Prometheus in the cluster. For more information, see Enable Prometheus monitoring.
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.comandack.alibabacloud.com/nodepool-idtags.
Enable cost insights
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, find the cluster you want and click its name. In the left navigation pane, choose .
Grant the AliyunCSManagedCostRole role and install the ack-cost-exporter component to enable cost insights.
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:
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.
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, find the one you want to manage and click its name. In the left navigation pane, click Add-ons.
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-roleIf 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