CostManagement
Achieve cost and resource cost visualization across multiple clusters. Administrators can intuitively understand cost distribution and resource usage in different clusters. Platform costs can be divided according to different business teams, helping each business team understand its cost allocation. This aids platform administrators in understanding the overall cost structure and taking appropriate measures to optimize resource allocation and control costs.
Glossary
| Term | Explanation |
|---|---|
| Usage | The actual CPU and memory usage of container groups. |
| Request | The expected request amount of CPU and memory for container groups. This is the amount of resources that container groups want the system to reserve for them. |
| __Idle__ | The idle cost of CPU and memory resources not allocated to any workloads. |
| Allocated | The cost of resources allocated to workloads. |
| Sum | In a specified time range, the sum of allocated cost and __Idle__ cost per day or per hour. |
| __Unmounted__ | The cost of storage resources occupied by pre-created, unallocated persistent volumes (PV). |
| __Total__ | The cumulative cost of CPU, memory, and storage resources. |
| __Other__ | A collection of namespaces not associated with any projects. |
| CPU/Memory/Storage Cost | The sum of allocated cost and the corresponding __Idle__ cost for CPU, memory, and storage. |
Prerequisites
-
In the configuration platform and Kubecost, there are three specific options for currency units, outlined as follows:
Use Case Solution Description Default Option Cost data in both the platform and Kubecost is displayed in USD. The currency unit in both the platform and Kubecost defaults to USD, requiring no currency unit replacement or exchange rate conversion operations. Recommended Option Cost data in both the platform and Kubecost is displayed in CNY. In a specified namespace on the platform, the currency unit for the platform can be set to CNY by adding a configuration dictionary (ConfigMap). Simultaneously, the currency unit in Kubecost can be set to CNY to ensure uniformity of currency in both the platform and Kubecost. Please refer to Configuring Currency Units in the Platform and Kubecost for specific details. Other Options Cost data in the platform and Kubecost is displayed in different currency units. In a specified namespace on the platform, the currency unit used by the platform and the exchange rate can be set by adding a configuration dictionary (ConfigMap). Additionally, the currency unit in Kubecost can be configured separately. For details, refer to Configuring Currency Units in the Platform and Kubecost . -
Please customize the hourly unit prices for CPU, memory, and storage. Log in to Kubecost, navigate to the Settings > PRICING page, and if Enable Custom Pricing is not enabled, default values will be used. If this option is enabled, fill in the actual subscription or usage prices for CPU, memory, and storage.
-
Deploy the CostManager plugin on the global cluster.
-
Deploy the Kubecost plugin on each cluster that displays cost data. The deployment and use of the Kubecost plugin depend on the Prometheus plugin. First, deploy the Prometheus plugin , and then deploy the Kubecost plugin .
General Parameters
In Platform or Cluster cost management, only the cost information of clusters that have successfully deployed the Kubecost plugin is included. In Project cost management, only the cost information of all clusters associated with the project and successfully deployed with the Kubecost plugin is included.
| Parameter | Description | Calculation Formula |
|---|---|---|
| Total Cost | The cumulative cost of CPU, memory, and storage resources in all clusters within a specified time range. | Total Cost = CPU Cost + Memory Cost + Storage Cost (excluding disk cost)
|
| CPU Utilization Efficiency | The Usage / Request of container group CPU in all clusters within a specified time range. | CPU Usage Efficiency = The sum of Usage of all container group CPUs in all clusters that have successfully deployed the Kubecost plugin / The sum of Request of all container group CPUs in all clusters that have successfully deployed the Kubecost plugin. |
| Memory Utilization Efficiency | The Usage / Request of container group memory in all clusters within a specified time range. | Memory Usage Efficiency = The sum of Usage of all container group memory in all clusters that have successfully deployed the Kubecost plugin / The sum of Request of all container group memory in all clusters that have successfully deployed the Kubecost plugin. |
| Cost Effectiveness | The cumulative cost of CPU and memory Usage compared to the cumulative cost of allocation in all clusters within a specified time range. | Cost Efficiency = ((CPU Usage Efficiency * CPU Allocated Cost) + (Memory Usage Efficiency * Memory Allocated Cost)) / (CPU Allocated Cost + Memory Allocated Cost)
|
| Cost Breakdown | Splits the total cost in the platform into resources, primarily CPU, memory, and storage. | - |
| Cost Trends | Displays the total, __Idle__, and allocated cost information for the selected time range. | - |
Platform Cost Management
Display platform cost information for a given time range, including only the cost information of clusters that have successfully deployed the Kubecost plugin. If all clusters in the platform have not deployed the Kubecost plugin, all parameters on the page are displayed as - or No data.
Cost Distribution Line Chart and List
| Parameter | Cluster Dimension | Project Dimension | Calculation Formula |
|---|---|---|---|
| Cost Distribution Line Chart | Displays the cost information of clusters that have successfully deployed the Kubecost plugin in the selected time range.
|
Displays the project cost information that can be statistically calculated in Kubecost in the selected time range.
|
- |
| Cost Distribution List | Displays __Total__, __Idle__, and all clusters that have deployed or not deployed the Kubecost plugin in the selected time range. The displayed information includes CPU, memory, storage, cost efficiency, and total cost. Tip: If the cluster has deployed the Kubecost plugin, you can click the corresponding cluster name to enter the cost page of the cluster to view detailed information. |
Displays __Total__, __Idle__, __Other__, and project cost information that can be statistically calculated in Kubecost in the selected time range. The displayed information includes: associated clusters, CPU, memory, storage, cost efficiency, and total cost. Note:
|
|
Cluster Cost Management
Cost Distribution Line Chart and List
| Parameter | Namespace Dimension | Project Dimension | Calculation Formula |
|---|---|---|---|
| Cost Distribution Line Chart | Displays the cost information of namespaces in the current cluster within the selected time range. Note: If the number of namespaces in the cluster exceeds 5, only the top 5 namespaces by cost are displayed. You can click the legend on the right to view the cost usage information of each namespace. |
Displays the project cost information that can be statistically calculated in Kubecost and is associated with the current cluster in the selected time range. | - |
| Cost Distribution List | Displays __Total__, __Idle__, __Unmounted__, and all namespaces in this cluster in the selected time range. The displayed information includes CPU, memory, storage, cost efficiency, and total cost. Tip: You can click the corresponding namespace name to enter Kubecost and view detailed cost information for that namespace. |
Displays __Total__, __Idle__, __Other__, and project cost information that can be statistically calculated in Kubecost and is associated with the current cluster. The displayed information includes: associated clusters, CPU, memory, storage, cost efficiency, and total cost. |
|
Project Cost Management
Cost Distribution Line Chart and List
| Parameter | Namespace Dimension | Calculation Formula |
|---|---|---|
| Cost Distribution Line Chart | Displays the cost information of all namespaces under the current project within the selected time range. Note: If the number of namespaces under the project exceeds 5, only the top 5 namespaces by cost are displayed. You can click the legend on the right to view the cost usage information of each namespace. |
- |
| Cost Distribution List | Displays __Total__, __Idle__, and the cost information of all namespaces under the project in the selected time range. The displayed information includes: associated clusters, CPU, memory, storage, cost efficiency, and total cost. Note:
|
|
Related Operations
Configuring Currency Units in the Platform
-
In the left navigation, click on Clusters > Resources.
-
Switch to the global cluster.
-
Click on Create Resource to add a new YAML configuration file, as shown below.
apiVersion: v1 kind: ConfigMap metadata: name: costmanager-currency namespace: finops-system data: rate: '1' unit: '¥'Field Descriptions:
Field Description metadata.name This field must be specified as costmanager-currencyand cannot be modified.metadata.namespace This field must be specified as finops-systemand cannot be modified.data.rate The exchange rate used in the platform. If not specified, it defaults to 1.
Note: If the currency units in the platform and Kubecost are different, conversion should be based on the real-time exchange rate. For example, if the platform uses CNY and Kubecost uses USD, this field should be filled with the current exchange rate, such as 7.1409.data.unit The currency unit used in the platform. Here, ¥ represents CNY, and $ represents USD. -
Click Create and reload the page.
Configuring Currency Units in Kubecost
-
Log in to Kubecost.
-
Click on the bottom left corner of the page on Settings.
-
Click on GENERAL > Cloud Cost Settings > the dropdown box in the Currency section, and choose CNY.
Note: CNY represents Chinese Yuan as the currency unit in Kubecost, while USD represents US Dollars.
-
Click SAVE at the bottom of the page to save the configuration and reload the page.