All Products
Search
Document Center

Container Service for Kubernetes:Overview of cost insights

Last Updated:Mar 15, 2024

The cost insights module of Container Service for Kubernetes (ACK) can help financial administrators in IT enterprises analyze the usage and cost trend of resources in ACK clusters and provides suggestions on cost savings to improve the overall resource utilization. The cost insights module can identify resource waste and estimate resource costs. This module accurately estimates the cost of a pod by analyzing bills, collecting resources usage statistics, and performing real-time inquiries. The cost insights module allows you to aggregate the statistics of different resources by application label, namespace, or cluster in the logical dimension. This module also allows you to aggregate the statistics of resources by node pool or cluster in the resource dimension. This topic describes the cost insights module of ACK and the features that this module provides.

Challenges in the traditional cost management mode

Large numbers of enterprises use cloud-native technologies for IT transformation in which cost optimization is an important objective. You can use the sharing, isolation, and scaling capabilities of cloud-native technologies to optimize the costs of resources. Compared with the traditional capacity planning method that is used to manage IT spending, cloud-native technologies pose greater challenges. The following section describes the challenges:

  • How to accurately calculate the cost of an ACK cluster?

  • How to accurately estimate the cost of a pod?

  • How to accurately estimate the cost of an online application or a CronJob?

  • How to use namespaces to allocate the cost of ACK cluster management by department?

  • How to identify and optimize cost waste in a cluster in a visualized manner?

How the cost insights module works

How to accurately calculate the cost of an ACK cluster?

The cost insights module of ACK adds the cluster ID as a unique label to the cloud resources that are deployed in an ACK cluster. These resources include Elastic Compute Service (ECS) instances, Server Load Balancer (SLB) instances, Alibaba Cloud disks, elastic IP addresses (EIPs), and elastic container instances. After a bill is generated in the Billing Management console, you can use the cluster ID label to check the relationship between the resources and the cluster.

How to accurately estimate the cost of a pod?

The following problems exist when you estimate the cost of a pod:

  • The billable items of cloud resources and pods are different. The cost of a pod varies based on the type of cloud resource that hosts the pod.

  • The lifecycles and billing cycles of cloud resources and pods are also different. In most cases, the billing cycle of a pod is shorter than the billing cycle of the cloud resource that hosts the pod.

  • The billable items of different types of pods vary because these pods may require different types of computing resources. In most cases, pods require CPU, memory, and GPU resources.

To resolve the preceding problems, the cost insights module of ACK analyzes historical bills and calculates real-time costs in order to estimate the cost of a pod.

To estimate the cost of a pod, the cost insights module must calculate the cost ratio of a pod based on its real-time cost. To do this, it first estimates the real-time cost of the pod by using the following formula: Real-time unit price of core hours of the cloud resource that hosts the pod × Pod uptime × Amount of CPU, memory, or GPU resources requested by the pod. Then, the module divides the real-time cost of the pod by the total cost of all pods to calculate the cost ratio of the pod. Finally, the cost insights module calculates the allocated cost of a pod based on the following formula: Allocated cost of a pod = Cost ratio of the pod × Total amount of payments in all bills that are generated within the specified time period.

Note

Bills are generated with a delay. In most cases, the bills of subscription resources are generated on a monthly basis. The bills of pay-as-you-go resources are generated on a daily basis. The unit price of preemptible instances is updated every 5 minutes. Fees that are offset by using reserved instances, savings plans, and coupons are not included in bills. Therefore, the cost insights module must use the cost ratio method to calculate the allocated cost of a pod.

How to accurately estimate the cost of an online application or a CronJob?

The cost insights module of ACK splits and estimates costs based on labels. This allows you to aggregate and split application costs from every dimension by using labels. Cost insights solve the problem that the lifecycles of pods provisioned for different types of Jobs are different. The lifecycles of pods for online applications are longer and pods may be created or deleted due to scaling activities. The lifecycles of pods for CronJobs are shorter. Applications that use different architectures may run in pods that assume different roles, such as Spark Driver and Executor. The system may also deploy large amounts of dynamic resources for these applications, such as ECS instances and elastic container instances.

How to use namespaces to allocate the cost of ACK cluster management by department?

A namespace is a group of pods that have one or more fields in common. After the cost insights module calculates the cost ratio of each pod, the module estimates the allocated cost of a namespace based on the following formula: Ratio of the cost of all pods in the namespace to the cost of all pods in the cluster × Amount in the cluster bill.

How to identify and optimize cost waste in a cluster in a visualized manner?

Cost waste occurs due to the following reasons: improper resource request settings, improper optimization of resource billing methods, and improper use of pod scheduling policies or auto scaling policies. The cost insights module can help you analyze and estimate costs in multiple dimensions, such as resources, pod scheduling topologies, real-time unit prices, and bills. It also provides suggestions on cost savings to avoid resource waste.

Key features

The cost insights module provides the following features.

Feature

Description

Cost analysis of cloud resources

Aggregates the costs of all cloud resources in an ACK cluster. Allows you to view the day-on-day cost and year-on-year cost.

Cost trend analysis of cloud resources

Analyzes the cost trends of all cloud resources. Lists cloud resources with the highest costs. This helps you reduce costs.

Suggestions on cost savings

Analyzes the cost trend of an ACK cluster. Provides correlation analysis between resource usage and costs. Provides suggestions on how to reduce costs.

Real-time cost estimation

Estimates the real-time prices of all computing resources within a cluster and estimates the hourly cost. Multiple billing methods, such as subscription, pay-as-you-go, and preemptible instances, are supported.

Cost allocation by namespace

Allocates the cost of a cluster by namespace. Provides real-time cost estimation, cost trend, and cost ratio per namespace.

Optimization of application costs

Lists the top 10 applications with the highest costs. Provides the cost trends of the top 10 applications. This helps you improve the cost-effectiveness of an application.