This topic demonstrates how to use Cost Insight based on real-world enterprise scenarios to calculate business cost allocation more accurately in a cloud-native architecture. This approach helps enterprises effectively manage and control costs while benefiting from the flexibility and efficiency of cloud-native technologies.
Prerequisites
-
Create a cluster with version 1.18.8 or later. For more information, see Manually upgrade a cluster.
-
Ensure the Prometheus metric storage duration is longer than your cost governance cycle. For more information, see Determine the cost governance cycle and Adjust the metric storage duration.
Background information
In traditional IT governance scenarios, each business typically uses a dedicated set of cloud resources—such as nodes, Server Load Balancer instances, and storage resources. These resources are billed independently, making cost tracking relatively straightforward.
In the cloud-native era, resource usage patterns have changed. A single node may run containers from multiple businesses simultaneously, and network and storage resources may be shared across applications. This resource-sharing model increases the complexity of cost allocation, making it difficult to assign costs clearly to individual business units and complicating cost insight and management.
To address this, ACK provides a general-purpose cost data model to help you calculate business cost allocation more accurately. The implementation works as follows:
-
First, analyze the resources (such as CPU, memory, and storage) used by each pod and calculate its simulated cost.
-
Next, allocate the cluster’s total bill—including all resource charges—to individual pods proportionally based on their simulated costs. This proportional split gives you each pod’s share of the cluster’s total bill.
-
Finally, sum the allocated costs of all pods associated with a specific business over a given period to determine that business unit’s total cost.
Scenario example
As shown in the following diagram, an enterprise deploys all its workloads on a single ACK cluster. Its organizational structure includes four departments: Department A manages Application A; Departments B and C jointly manage Application B; and Department D manages Applications C and D.
Applications A and B are web services requiring stable workloads and are scheduled onto subscription ECS instances. Applications C and D handle data processing and DataAnalysis workloads with elastic resource demands and are scheduled onto pay-as-you-go ECS instances.
Use Cost Insight for cost management and optimization
The following steps show how to use the visual Cost Insight dashboard to view costs by department and application.
Step 1: Determine the cost governance cycle
-
Cluster cost viewing cycle:
ECS instances have two billing cycles: subscription instances are billed monthly or weekly, while pay-as-you-go instances are billed hourly. Since this scenario uses both billing types, set the viewing cycle at the monthly level when reviewing total cluster costs. To simplify direct comparison and analysis of billing data, use the ECS billing date as the start and end dates for cost governance.
-
Department and application cost viewing cycle:
-
Departments A, B, and C run workloads on subscription nodes, so their cost governance cycle is monthly.
-
Department D runs workloads on pay-as-you-go nodes, so its cost governance cycle is daily.
-
Determine the application cost viewing cycle based on its owning department.
-
Step 2: Choose a cost allocation strategy based on workload type
When calculating business cost allocation, ACK estimates the cost of pods associated with each business. ACK offers two estimation strategies: single-resource and weighted hybrid-resource.
|
Estimation strategy |
Sub-strategy |
Use case |
|
Single-resource policy for CPU and memory resources |
Scenarios where one resource type is significantly more utilized than another, or where workloads in the cluster predominantly request one type of resource. |
|
|
CPU-memory hybrid strategy (recommended weights) and CPU-memory hybrid strategy (custom weights). |
Scenarios where CPU-intensive and memory-optimized applications are mixed in the cluster, or where CPU and memory utilization levels are similar. |
By default, use the single-resource estimation strategy when workloads in the cluster predominantly request one type of resource. For example, if all workloads are CPU-intensive, select the CPU-only strategy.
For more guidance on strategy selection and analysis, see Cost estimation strategies.
Step 3: View cluster costs
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
-
On the Cost Insights page, go to the Cluster Dimension tab. Set the following filters and review the cost results.
-
Actual/Original Bill: Select a cluster cost calculation option. In this example, set it to Actual post-discount bill cost.
-
Time range: In this example, set it to 2024-05-01 00:00:00 to 2024-05-31 23:59:59.
In the Month-to-date spending – Actual post-discount bill cost section, view the cluster’s total cost for May 2024. After applying these settings, the page displays an overview of cluster spending, including metric cards for Yesterday’s cluster cost, Day-over-day spending change, Tomorrow’s predicted cost, Week-to-date spending, Month-to-date spending, and Projected month-end total, along with a Cluster spending and capacity trend graph. The value shown in Month-to-date spending – Actual post-discount bill cost represents the cluster’s actual total cost for the month.
-
Step 4: View department costs
-
On the Cost Insights page, go to the Namespace Dimension tab. Set the following filters and review the cost allocation results.
-
Namespace (Namespace): Select the namespace corresponding to the department. In this example, use the default namespace default.
-
Actual/Original Bill: Select a namespace cost calculation option. In this example, set it to Actual post-discount bill cost.
-
Time range: In this example, set it to 2024-05-31 00:00:00 to 2024-05-31 23:59:59.
In this example, Department D’s workloads have variable resource demands. You can also adjust the time range to a specific day—such as May 31, 2024—to view Department D’s daily costs.
Then, in the Namespace cost allocation section, view the department’s allocated cost.
-
Step 5: View application costs
-
On the Cost Insights page, go to the Application Dimension tab. Set the following filters and review the application spending.
-
Namespace (Namespace): Select the namespace where the application runs. In this example, use the default namespace default.
-
Label selector: Enter the label associated with the application.
-
Time range: In this example, set it to 2024-05-31 10:00 to 2024-05-31 16:59.
In this example, Applications C and D have variable daily costs due to their workload characteristics. Therefore, narrow the time range to a specific window—such as 10:00 to 16:59—to view costs during that period.
Then, in the Application spending section, view the results.
This page displays the following monitoring metric cards: Application spending (total application cost), Current replica count (current/maximum/minimum replicas), Compute resource utilization (CPU, memory, GPU memory), Hourly node cost (cost per node), Application runtime / total core-hours consumed, and Application’s share of cluster/namespace resource utilization.
-
FAQ
After enabling Cost Insight, why is there no data when I view last month’s or last week’s spending?
Cost Insight starts recording data only after you enable the feature. No data exists for periods before activation.
When viewing historical spending, why is the displayed amount lower than my actual spending?
ARMS Prometheus stores metrics for 15 days by default. Ensure your selected time range falls within this storage window. If you need a longer cost insight period, see Adjust the metric storage duration.
References
-
Besides the visual Cost Insight dashboard, you can also use the Allocation API to retrieve department and application cost allocations from the cluster bill. The Allocation API lets you aggregate business costs by namespace, controller, label, pod, and other dimensions.
-
For detailed explanations of Cost Insight metrics, see Cluster-level cost analysis, Namespace-level cost analysis, Node pool-level cost analysis, and Application-level cost analysis.
-
If you want to simplify setting requests and limits for containers, use the Resource Profiling feature to obtain container-level resource recommendations and adjust your application configurations.
-
In multicloud and hybrid cloud scenarios, resources may come from multiple cloud providers or even on-premises environments, making unified resource monitoring and cost management more challenging. For details on using ACK One for hybrid cloud cost management, see Cluster cost insight.