The cost insights feature of Container Service for Kubernetes (ACK) provides dashboards that display visualized information about the costs of your clusters, namespaces, node pools, and applications.
Requirement
The cost insights feature is enabled. For more information, see Enable the cost insights feature.
Note
After you enable the cost insights feature, the bill data is automatically displayed at 08:00 the next day. You can select a time range from the drop-down list in the upper-right corner to view the cost data of the cluster within the specified time range.
Procedure
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the cluster that you want to manage. In the left-side navigation pane, choose .
On the Cost Insights page, click different tabs to view the cost visualization dashboards.
Cluster cost analysis
Filter options
Feature | Ordinal number | Description |
Cluster cost analysis options | ① | The cluster cost analysis options.
For more information, see Bill details. Note The costs of applications in the cluster can be analyzed by namespace or pod. The application cost is calculated based on the bill amount of the resources. |
Cost allocation models | ② | The cost allocation models include single-resource models and weighted multi-resource models. For more information, see Cost estimation strategies.
|
Time range | ③ | The time range of the dashboard. The default value is Last 7 Days. You can specify a time range to view the changes in costs and resources within the specified time period. |
Cluster cost overview
Feature | Ordinal number | Description |
View the cost allocation model | ① | The data is related to the selected Cost Allocation Model. By default, the CPU Model is selected. This model estimates the cost of a pod based on the amount of CPU resources requested by the pod. |
The cost of the previous day, the cumulative cost of the week, and the cumulative cost of the month. | ② | The cost of the previous day, the day-on-day ratio, the cumulative cost of the week, and the cumulative cost of the month are all calculated based on the bill amount of the cloud resources in the cluster. The weekly cumulative cost is calculated based on the bill amount of every calendar week and the monthly cumulative cost is calculated based on the bill amount of every calendar month. Bills are generated one day after the transaction date. Therefore, the cumulative cost of the week is zero on Monday of each week and the cumulative cost of the month is zero on the first day of each month. The day-over-day growth rate compares the cluster cost of the previous day and the cluster cost of the day before the previous day. A green value indicates a decrease and a red value indicates an increase. |
Brief information about the cluster cost and resource waste. | ③ | The charts display changes in the cluster cost and cluster capacity. The yellow curve indicates the cluster cost and the blue curve indicates the actual cluster capacity. In most cases, the two curves are correlated with each other. If the two curves represent different trends, it indicates changes in the average cost of individual CPU cores. In this case, you can check whether resources of higher prices are consumed. |
Display the real-time estimated costs of namespaces and allocated cost of each namespace | ④⑤ | Section (4) displays the real-time estimated cost of each namespace in the cluster. The cost of a namespace is the sum of costs of all pods in the namespace. Section (5) displays the allocated cost of each namespace, which is the cluster cost allocated to each namespace based on the specified cost ratio. Note
The specifications and billing methods of nodes in a cluster may vary. When you allocate costs by namespace, you must consider not only the resource requests of each namespace but also the nodes that host the pods in the namespace. The cost insights feature converts the real-time cost of each node. When the feature calculates the cost of a namespace, it uses the following formula: However, due to the deferred billing policy applied when discounts, vouchers, or the subscription billing method is used, the cost calculated based on this formula may differ from the bill amount. You can allocate costs by multiplying the cluster cost by the cost ratio of each namespace. |
Stability and efficiency analysis
Feature | Ordinal number | Description |
Display the total resource usage of the cluster | ① | The number of pods of each Quality of Service (QoS) class and the total resource usage in the cluster. |
Display the pod resource usage in the cluster | ② | The basic information and resource utilization (Usage/Request) of all pods in the cluster. You can filter and sort the pods. This feature allows you to view the workloads with the highest or lowest resource usage in the cluster. |
Display the resource configurations of burstable pods in a cluster | ③ | The resource configurations of burstable pods in the cluster. You can filter and sort the pods. This feature allows you to view the CPU and memory resource requests and limits of each burstable pod. This helps you understand the cluster resources consumed by the pods and identify potential resource bottlenecks. |
Display the resource usage of BestEffort pods in a cluster | ④ | The resource configurations of BestEffort pods in the cluster. These pods may have stability issues. You can filter and sort the pods to check whether unexpected BestEffort pods exist in the cluster to avoid risks. |
For more information about the Stability & Efficiency Analysis feature, see Use the cost insights feature to identify cluster resource risks.
Cluster cost analysis
Feature | Ordinal number | Description |
Display changes in the cloud resource cost and the cost ratios of different cloud resources | ①② | Section (3) displays the cost ratios of different cloud resources in the cluster. Section (4) displays changes in the cloud resource cost. A cluster may use multiple cloud resources. The costs of cloud resources vary based on billing rules and how the cloud resources are used by the cluster. You can view the costs of different cloud resources to make cost-related decisions. |
Display changes in the total cluster cost | ③ | Display daily changes in the total cluster cost. |
Display the costs of node pools | ④ | The bill amount of each node pool or virtual node in the cluster. |
Display the trends in real-time estimated costs of namespaces | ⑤ | The specifications and billing methods of nodes in a cluster may vary. When you allocate costs by namespace, you must consider not only the resource requests of each namespace but also the nodes that host the pods in the namespace. The cost insights feature converts the real-time cost of each node. When the feature calculates the cost of a namespace, it uses the following formula: However, due to the deferred billing policy applied when discounts, vouchers, or the subscription billing method is used, the cost calculated based on this formula may differ from the bill amount. You can allocate costs by multiplying the cluster cost by the cost ratio of each namespace. |
Display changes in the resource request and resource utilization of the cluster | ⑥ | Scenarios:
Histogram chart:
Analysis procedure:
|
Cluster billing details | ⑦⑧ | A list of daily bills displayed by cloud resource or instance. |
Namespace cost analysis
The namespace dashboard allows you to filter namespaces and view the resource and cost information of each namespace. Namespaces are used to manage resources that belong to different departments or teams.
Filter options
Feature | Ordinal number | Description |
Namespace | ① | Select a namespace to analyze. The default value is ALL, which indicates that all namespaces in the cluster are selected. |
Cost allocation models | ② | The cost allocation models include single-resource models and weighted multi-resource models. For more information, see Cost estimation strategies.
|
Namespace cost analysis options | ③ | The cluster cost analysis options.
For more information, see Bill details. |
Time range | ④ | Select a time range for the dashboard. The default value is Last 7 Days. You can view the changes in costs and resources within the specified time period. |
Billing overview
Feature | Ordinal number | Description |
Statistics, estimated costs, and allocated costs of resources in namespaces | ① | You can identify resource waste in the namespace based on the CPU and memory metrics. Metrics:
|
② | Section (2) displays the cost statistics of the applications in the namespace.
|
Cost details and trends
Feature | Ordinal number | Description |
Unit price of core hours | ① | Display changes in the unit price of core hours of the nodes that host the pods of the application. |
Changes in CPU and memory utilization | ② | Display changes in the CPU and memory utilization of the namespace. |
Changes in the resource request and usage | ③ | The resource allocation trend and resource usage trend. The blue curve indicates the trend of allocated resources and the red curve indicates the trend of resources in use. A node reserves resources for pods during pod scheduling. The amount of resources occupied by container processes usually differs from the amount of allocated resources. The two curves can help you optimize resource allocation and avoid resource waste. |
Changes in costs of applications in the namespace | ④ | Display changes in the costs of applications in the namespace. The total cost is the bill amount of the namespace within the specified time range. The ratio of the namespace cost to the cluster cost. |
Feature | Ordinal number | Description |
Pod ranking by resource requests | ① | Sort pods based on resource requests to help you identify the application that requests the most resources and optimize resource allocation. |
Pod ranking by resource utilization | ② | Sort pods based on resource utilization to help you identify the application with the lowest resource utilization and avoid resource waste. |
Pod ranking by idle resources | ③ | The idle resource ratio of a pod is the ratio of resources that are not used by the pod to the total resources allocated to the pod. The value helps you identify resource waste in the pod. You can identify the pods with the most idle resources in the namespace to locate the applications that cause resource waste in the namespace. Then, you can analyze the causes of resource waste and design targeted resource optimization policies. |
Node pool cost analysis
The node pool dashboard displays the cost of cluster resources to help you analyze the use of node pools and choose a proper billing method.
You can analyze the costs of different node pools and then conduct cost control and governance. For example, GPU-accelerated node pools may belong to multiple departments. Therefore, it is difficult to analyze the cost by namespace. In this scenario, you can allocate cost by node pool and set cost optimization policies for different node pools.
Filter options
Feature | Ordinal number | Description |
Node pool cost analysis options | ① | The cluster cost analysis options include the following options:
For more information, see Bill details. |
Node pool | ② | Select a node pool to analyze its cost. The default setting is All, which means that all node pools in the cluster are selected. |
Time range | ③ | Select a time range for the dashboard. The default value is Last 7 Days. You can view the changes in costs and resources within the specified time period. |
Billing overview
Feature | Ordinal number | Description |
Node pool cost | ① | The ratio of the cost of the current day to the cost of the previous day. A green value indicates a decrease and a red value indicates an increase. |
Unit price of core hours of nodes | ② | Display changes in the unit price of core hours of the nodes in the node pool within a period of time. |
Changes in node costs and changes in the node pool cost ratio | ③④ | Display changes in the costs of the nodes in the node pool, and changes in the ratio of the node pool cost to the total cluster cost. |
Billing method and cost estimation
Feature | Ordinal number | Description |
Estimate cost savings based on the billing methods of nodes to help you optimize resource allocation and select a proper billing method. | ①②④ | Display changes in the ratios of nodes that use different billing methods within a period of time, and changes in the cost ratios of nodes that use different billing methods in the node pool. The following billing methods are supported:
|
③⑥ | Estimate cost savings after you change the billing method of nodes to help you optimize resource allocation and select a proper billing method. | |
⑤ | Cost and billing method statistics about the nodes in the node pool. |
Application cost analysis
The application dashboard allows you to use label wildcards to filter applications and view the cost and resource usage of the desired applications. Application cost analysis focuses on scenario-specific cost optimization. Application cost analysis applies to scenarios such as big data computing, AI computing, and elastic scaling.
Label wildcards allow you to monitor not only the cost and resource usage of a single application but also the cost and resource usage of multiple related applications. For example, in a big data workflow scenario, you can add the same label to all applications in the workflow to analyze the cost of the entire workflow.
Filter options
Feature | Ordinal number | Description |
Node pool cost analysis options | ① | The cluster cost analysis options include the following options:
For more information, see Bill details. |
Namespace | ① | Select a namespace to analyze its cost. The default setting is All, which means that all namespaces in the cluster are selected. |
Filter applications by label | ② | Enter a pod label. You can use If the label key contains |
Cost allocation models | ③ | The cost allocation models include single-resource models and weighted multi-resource models. For more information, see Cost estimation strategies.
|
Time range | ④ | Select a time range for the dashboard. The default value is Last 7 Days. You can view the changes in costs and resources within the specified time period. |
Billing overview
Feature | Ordinal number | Description |
Application costs and computing resource utilization | ① | Display the cost of an application in real time and analyze the resource utilization of the application.
|
Pod cost analysis | ② | The resource information and real-time estimated cost of each pod in the application. |
Changes in estimated application costs and number of pods | ③ |
|
Changes in CPU, memory, and GPU requests and usage | ④ | CPU, memory, and GPU requests and charts:
Analysis procedure:
|
Billing method and pod usage
Feature | Ordinal number | Description |
Estimate cost savings after you change the billing method of nodes | ① | Estimate cost savings or additional costs after you change the billing method of all nodes that host the application to help you optimize resource allocation and select a proper billing method. |
Application cost statistics | ②③ | Display the billing method statistics of the nodes that host the application pods and the hourly cost of the nodes to help you select a proper billing method for the nodes. |
Pod ranking by resource requests, resource utilization, and idle resources | ④ | The following rankings can help you identify the application with the most idle resources to avoid resource waste:
|
Use the cost insights feature to analyze the costs of IDC nodes and applications in registered clusters
The cost insights feature allows you to analyze the costs of IDC nodes and applications in registered clusters. The default unit price is CNY 0.3/vCore hour. You can customize the unit price of IDC nodes by using the following methods.
Set a CPU unit price for all on-premises servers
Add the
DefaultIDCPricePerCPUCoreHour
environment variable to the ack-cost-exporter Deployment in the kube-system namespace to specify a CPU unit price for all on-premises servers.NoteThe unit of the price is CNY/vCore hour.
env: # Set the CPU unit price to CNY 0.3/vCore hour. - name: DefaultIDCPricePerCPUCoreHour value: "0.3"
Set a unit price for a node
Add the
"node.kubernetes.io/price-per-day"
label to a node to specify a unit price for the node.NoteThe unit of the price is CNY/day.
Run the following command to set the unit price of the node to CNY 100/day.
kubectl label nodes <node-name> node.kubernetes.io/price-per-day="100"
FAQ
Why is no data displayed after I enable the cost visualization feature?
Check whether the RAM role is granted the required permissions. For more information, see Step 3 in the topic about how to enable the cost analysis feature. The cost analysis feature requires the monitoring data and cost data of the cluster. The monitoring data is collected within 3 minutes after you enable the feature. The cost data is displayed at 08:00 the next day after you enable the feature.
Check whether a NAT gateway is configured for the cluster. You cannot use the internal endpoint to query bills in certain regions. Make sure that your cluster has Internet access.
The day-over-day growth rate and predicted cost of the next day are displayed only after the cost data is collected for two consecutive days.
Why does the sum of namespace costs differ from the actual bill amount?
The costs of namespaces are estimated based on the original price. Therefore, when discounts, vouchers, or the subscription billing method is used, the estimated costs may differ from the bill amount. You can allocate costs by multiplying the cluster cost by the cost ratio of each namespace.
Why is the cost data of some pods on nodes unavailable?
Check whether the RAM role authorization operation is completed, and confirm that the authorization policy includes the "ecs:DescribeDisks" permission. For more information, see Step 3 of enabling the cost analysis feature.
Why does the bill not include all cloud resources used by the cluster?
The cost analysis feature analyzes only the cloud resources that are exclusively used by the cluster. Cloud resources that are shared by multiple clusters are not included in the bill.
The cost insights feature depends on the cost tag feature in the Billing and Cost Management console. The feature tracks and analyzes the costs of a cluster based on a specific tag (key: value=ack.aliyun.com:{{ClusterId}}
) in the cloud resource tag. If you disable this tag on the Cost Tags page, the cluster cost analysis feature becomes invalid. To resolve this issue, enable the ack.aliyun.com
and ack.alibabacloud.com/nodepool-id
tags on the Cost Tags page.
Why is the cumulative cost of the month or week lower than the actual cost?
The cost data of a cluster before you enable the cost insights feature is not analyzed when the cost insights feature calculates the cluster cost.