Feature Description
Traditional Kubernetes clusters usually focus solely on resource-level data, such as the Allocatable indicator for nodes representing resources that can be allocated, and Metrics-Server that can monitor the utilization of nodes and pods. TKE Insight has introduced Cost Insight, a cost visualization dashboard that helps users better understand, monitor, and control resource usage and cost situations in a containerized environment. It mainly includes the following objectives:
Transparency: Users can intuitively understand the resource usage of applications and services in a containerized environment, including the cost consumption in terms of CPU and memory across different clusters, namespaces, and workloads. This helps users comprehend the overall cost structure and improve decision-making efficiency.
Cost control and optimization: Through Cost Insight, users can identify applications or services with high costs. Users can optimize such issues, for example, through intelligent request recommendation, preemptible jobs, the native node dedicated scheduler, and QoSAgent, to reduce unnecessary expenses.
Budget management: Users can formulate more reasonable budgets based on actual cost situations and monitor budget implementation. When resource usage approaches or exceeds the budget, users can adjust policies in time to avoid extra expenditures.
Directions
2. On the left, select TKE Insight > Cost Insight.
Instructions
The cost value in Cost Insight is a calculated value for reference only. For accurate costs, log in to Tencent Cloud Billing Center to check. Super nodes cannot distinguish whether the pay-as-you-go billing is for general pay-as-you-go or bidding pods. Therefore, it is currently not supported to use reserved coupons to offset the cost of pods of corresponding specifications. This is because reserved coupons require API calls to query coupon information during cost calculation, and placing the call in the monitoring component would put significant pressure on the API.
The percentage change in costs for the current month compared with the previous month will not be displayed if there is no cost data for the previous month.
In cost calculation, the GPU usage of pods is not accounted for. Instead, the price of the GPU is amortized over the CPU and memory. As a result, the unit price of CPU and memory on GPU nodes is increased.
For the list price indicators of native nodes and general nodes, data is reported based on the unit price of the pay-as-you-go billing mode as the billing mode of nodes cannot be obtained.
For pods on super nodes billed on a pay-as-you-go basis, when multiple GPU types are specified in the annotation, the price is calculated based on the first GPU type.
Pricing
Billing Mode
Billing items include general nodes (CVM), native nodes, and super nodes.
General Node Billing Mode
Based on the node model and billing mode (pay-as-you-go), find the node's list price.
Note:
The model is indicated in the node's annotation of node.kubernetes.io/instance-type.
Native Node Billing Mode
Based on the node model and billing mode (pay-as-you-go), find the node's list price.
Note:
The model is indicated in the node's annotation of node.kubernetes.io/instance-type.
Super Node Billing Mode
Pay-as-you-go
List price of pay-as-you-go super node = Sum of list prices of nodes of the super node where pods are located
The list price of a node where a pod is located is calculated as follows:
Determine the CPU and GPU types of the node. If multiple CPU types are specified, use the first type for price calculation. If multiple GPU types are specified, use the first type for price calculation.
If the GPU type is not empty, look up the CPU unit price, memory unit price, GPU unit price, and license unit price (which is 0 CNY license is free) corresponding to the GPU type. If the GPU type is empty, look up the CPU unit price and memory unit price corresponding to the CPU type.
Calculate the list price of the pod: GPU specification × GPU unit price + CPU specification × CPU unit price + Memory specification × Memory unit price + License unit price.
Note:
The CPU type is indicated in the pod's annotation of eks.tke.cloud.tencent.com/cpu-type.
The GPU type is indicated in the pod's annotation of eks.tke.cloud.tencent.com/gpu-type.
Reporting Node List Price to Tencent Cloud Observability Platform
1. For nodes, the list price of each node will be reported to Tencent Cloud Observability Platform (TCOP). Currently supported granularities include 5min and 1h. The 5min granularity represents the price of the node per 5 minutes, and the 1h granularity represents the price of the node per 1 hour. 2. For pods on pay-as-you-go super nodes, the list price of each pod will be reported. Currently supported granularities include 5min and 1h. The 5min granularity represents the price of the sun-machine where the pod is located per 5 minutes, and the 1h granularity represents the price of the sun-machine where the pod is located per 1 hour.
1. Method of Calculating the Cost of the Current Month
Fetch the last month's prices of general nodes, native nodes, and super nodes from TCOP and add them together to get a total price.
2. Method of Estimating the Cost of the Next Month
Fetch the last hour's prices of general nodes, native nodes, and super nodes at the 1h granularity from TCOP. Assume that the sum of the last hour's prices of general nodes, native nodes, and super nodes is x CNY, the estimated cost for the next month is x × 24 × 30 CNY.
3. Cost Trend
Today's cost: Fetch the last day's prices of general nodes, native nodes, and super nodes from the monitor, and add the prices together.
Current month's cost trend: Fetch the last month's prices at the 1h granularity from Cloud Monitor. The frontend displays the cost trend of the last month at the 1h granularity.
Note:
The data point of each hour represents the sum of list prices of general nodes, native nodes, and super nodes at the corresponding time point.
4. Resource Cost Distribution
Fetch the last hour's costs of general nodes, native nodes, and super nodes. Multiply each cost by 24 and 30 to calculate the last month's cost of each general node, native node, and super node.
5. Namespace Cost Distribution
Estimate the monthly cost of each namespace load in the cluster based on the cost of the last hour.
1. Retrieve all nodes in the current cluster (general nodes, native nodes, and super nodes).
2. Fetch the CPU usage and memory usage of each pod on general nodes and native nodes from TCOP.
3. Fetch the model information of CVM nodes and native nodes in the current cluster, and calculate the CPU unit price and memory unit price of each model (the CPU unit price and memory unit price of super nodes are fixed, so no calculation is needed). The calculation method is as follows:
3.1 Based on the price estimates for all models across the network, the CPU unit price is x CNY/core/hour, and the memory unit price is y CNY/GB/hour.
3.2 Based on step 3.1, determine the ratio of CPU unit price/Memory unit price. Then, convert the price of the entire machine to a memory-based price to find the memory unit price of the machine. Next, multiply the memory unit price by the ratio to find the CPU unit price. For example, if CPU unit price/Memory unit price = r, the machine has x cores and y GB, and the machine price is z, then the calculation method for CPU and memory unit prices is:
Memory unit price of the machine: z/(xr+y)
CPU unit price: r(z/(xr+y))
4. Based on the CPU usage and memory usage of each pod obtained in step 2, and the CPU unit price and memory unit price of the node where the pod is located, calculate the price of each pod.
5. Based on the pay-as-you-go super nodes obtained in step 2, obtain the list price of pods on the pay-as-you-go super nodes from TCOP.
6. Based on the pod cost information calculated in steps 4 and 5, aggregate the cost information for each namespace.
7. Idle cost: The total cost of all current nodes minus the sum of the namespace costs.
6. Workload Cost Distribution
Estimate the monthly cost of each workload in the cluster based on the cost of the last hour.
1. Retrieve all nodes in the current cluster (general nodes, native nodes, and super nodes).
2. Fetch the CPU usage and memory usage of each pod on general nodes and native nodes from the monitor.
3. Fetch the model information of general nodes and native nodes in the current cluster, and calculate the CPU unit price and memory unit price of each model (the CPU unit price and memory unit price of super nodes are fixed, so no calculation is needed. CPU unit price: 36 CNY/core/hour, memory unit price: 18 CNY/GB/hour). The calculation method is as follows:
3.1 Based on the estimates from TKE FinOps (based on the prices of all models across the network), the CPU unit price is x CNY/core/hour, and the memory unit price is y CNY/GB/hour.
3.2 Based on step 3.1, determine the ratio of CPU unit price/Memory unit price. Then, convert the price of the entire machine to a memory-based price to find the memory unit price of the machine. Next, multiply the memory unit price by the ratio to find the CPU unit price. For example, if CPU unit price/Memory unit price = r, the machine has x cores and y GB, and the machine price is z, then the calculation method for CPU and memory unit prices is:
Memory unit price of the machine: z/(xr+y)
CPU unit price: r(z/(xr+y))
4. Based on the CPU usage and memory usage of each pod obtained in step 2, and the CPU unit price and memory unit price of the node where the pod is located, calculate the price of each pod.
5. Based on the pay-as-you-go super nodes obtained in step 2, obtain the list price of pods on the pay-as-you-go super nodes from TCOP.
6. Based on the pod cost information calculated in steps 4 and 5, aggregate the cost information for each workload.
7. Idle cost: The total cost of all current nodes minus the sum of the workload costs.
Was this page helpful?