This topic introduces the cost analysis feature and describes how to configure cost analysis for a Container Service for Kubernetes (ACK) cluster.

Prerequisites

  • The Kubernetes version of your ACK cluster is 1.18.8 or later. If the Kubernetes version is earlier than 1.18.8, update to 1.18.8 or later. For more information, see Update the Kubernetes version of an ACK cluster.
  • Application Real-Time Monitoring Service (ARMS) Prometheus is enabled for your cluster. For more information, see Enable ARMS Prometheus.
  • The cost analysis feature is enabled for your cluster. For more information, see Enable cost analysis.

View cost analysis results

  1. Log on to the ACK console.
  2. In the left-side navigation pane of the ACK console, click Clusters.
  3. On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.
  4. In the left-side navigation pane of the details page, choose Operations > Cost Analysis.
  5. On the Cost Analysis page, click the Cluster tab to view the dashboard that displays the analysis results.
    Note
    • After cost analysis is enabled, bills are displayed at 08:00:00 (UTC+8) on the next day.
    • You can click the drop-down list in the upper-right corner of the Cluster tab to change the time range.
    Dashboard that provides visualized information about the cost

Cluster cost analysis

Dashboard that provides visualized information about the cost

The following table describes the features of the dashboard.

No. Feature Description
1 Analyze the resource waste of the cluster based on the cost trend The dashboard displays information about the cost of the cluster. Daily Cost indicates the cost of the previous day. Weekly Cost indicates the cost of the previous week. Monthly Cost indicates the cost of the previous month. Day-on-day Ratio indicates the growth rate of the cost of the previous day.
  • If the growth rate is in green color, it indicates that the cost of the previous day is reduced compared with the cost of the day before the previous day.
  • If the growth rate is in red color, it indicates that the cost of the previous day is increased compared with the cost of the day before the previous day.
2 The yellow curve indicates the resource consumption of the cluster. The blue curve indicates the actual resource capacity of the cluster. In common cases, the two curves may be correlated with each other.

If the two curves represent different trends, it indicates changes to the average cost of individual CPU cores. In this case, you can check whether resources of higher prices are consumed.

3 The cost trend within a specific time period.
4 Allocate the cost based on namespaces

A cluster may contain nodes of different specifications and billing methods. When you allocate the cost based on namespaces, you must consider the price differences of nodes that host pods in different namespaces, not only the resource consumption of different namespaces.

The cost analysis feature converts the real-time cost of each node and provides the following formula to calculate the cost of a namespace:
Σ (Pod resource request/Node capacity) × Node unit price

This provides a precise method to calculate the cost of a namespace. However, discounts, vouchers, and subscriptions may cause the actual cost to be different from the cost calculated based on this formula. To obtain the actual cost of a namespace, you can multiply the actual cost of the cluster by the ratio of the cost of this namespace to the total cost of all namespaces.

5 Analyze the costs of cloud resources based on cost trends 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. This feature provides the cost trends and contributions of different cloud resources. This provides information that helps you reduce the cost of the cluster.

FAQ

Solution: Check whether the RAM role is granted the required permissions. For more information, see Step 5 in the Enable cost analysis topic. Cost analysis is based on monitoring data and cost data. The collection of monitoring data starts within 3 minutes after you enable cost analysis. Cost data is displayed at 08:00:00 (UTC+8) on the next day.
Solution: The cost of a namespace is calculated based on cost estimation and is not directly related to the actual bills. Therefore, the cost estimation is based on the list prices. However, the actual cost of a cluster can be reduced by vouchers, discounts, and cost saving plans. As a result, the total estimated cost of all namespaces may not equal the actual cost of the cluster. To obtain the actual cost of a namespace, you can multiply the actual cost of the cluster by the ratio of the cost of this namespace to the total cost of all namespaces.
Solution: Check whether the RAM role is granted the required permissions. Make sure that the ecs:DescribeDisks permission is included in the permission policy. For more information, see Step 5 in the Enable cost analysis topic.