The cost insights feature of Container Service for Kubernetes (ACK) helps the finance department analyze resource usage and allocate costs from multiple dimensions. This feature also offers suggestions on cost savings. This topic describes how to enable and disable the cost insights feature.
Prerequisites
The Kubernetes version of your cluster is 1.18.8 or later. If the Kubernetes version of your cluster is earlier than 1.18.8, update the Kubernetes version. For more information, see Update an ACK cluster.
Managed Service for Prometheus is enabled. For more information, see Enable Managed Service for Prometheus.
Enable cost insights
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, find the cluster that you want to manage and click its name. In the left-side pane, choose .
Assign the AliyunCSManagedCostRole Resource Access Management (RAM) role to your cluster and install the ack-cost-exporter component.
Authorize your ACK cluster to access your billing data in Billing Management
If you use an ACK managed cluster, the system automatically grants the required permissions. After the authorization is complete, the system automatically creates the AliyunCSManagedCostRole role. Managed Service for Prometheus assumes the RAM role to access your billing data in Expenses and Costs.
You can also click the Cloud Resource Access Authorization hyperlink. On the Cloud Resource Access Authorization page, click Agree to Authorization.
Install the ack-cost-exporter component
Follow the on-screen instructions to install the ack-cost-exporter component. After the component is installed, you are automatically redirected to the Cost Insights page.
Disable cost insights
If you do not need to use the cost insights feature, you can uninstall the ack-cost-exporter component and disable the feature.
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, find the cluster that you want to manage and click its name. In the left-side navigation pane, choose .
On the Add-ons page, find ack-cost-exporter and click Uninstall. In the Uninstall message, click OK.
FAQ
What do I do if I fail to install or uninstall the ack-cost-exporter component?
If you fail to install ack-cost-exporter, run the following commands to delete the resources related to ack-cost-exporter. Then, install ack-cost-exporter again. For more information about how to install ack-cost-exporter, 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 you fail to uninstall ack-cost-exporter, run the following commands to delete the resources related to ack-cost-exporter.
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