tencent cloud

Feedback

HPA Metrics

Last updated: 2024-12-19 22:09:58
Horizontal Pod Autoscaler (HPA) can automatically scale the number of Pods for services according to the average CPU utilization of target Pods and other metrics. You can set auto-scaling triggering metrics in the console including CPU, memory, disk, network, and GPU metrics. You can also use these metrics when creating and editing HPAs with YAML files. This document provides an example of configuring a YAML file.

Autoscaling Metrics

The following tables list the details of the autoscaling metrics:
Note:
Each variable under metricName has its own unit which is listed in the default unit column. You can omit such units when compiling the YAML file.

CPU metrics

Metric Name
in the Console
Unit
in the Console
Remarks
Type
metricName
Default Unit
CPU Usage
Core
Number of CPU cores used by the Pod
Pods
k8s_pod_cpu_core_used
Core
CPU Utilization
(per node)
%
Percentage of total CPU of the node used by the Pod
Pods
k8s_pod_rate_cpu_core_used_node
%
CPU Utilization
(per Request)
%
Ratio of the total number of CPU cores used by the Pod and the value of Request specified by the container in the Pod
Pods
k8s_pod_rate_cpu_core_used_request
%
CPU Utilization
(per Limit)
%
Ratio of the total number of CPU cores used by the Pod and the sum of Limit specified by the container in the Pod
Pods
k8s_pod_rate_cpu_core_used_limit
%

Disk metrics

Metric Name
in the Console
Unit
in the Console
Remarks
Type
metricName
Default Unit
Disk Write Traffic
KB/s
Pod's disk write rate
Pods
k8s_pod_fs_write_bytes
B/s
Disk Read Traffic
KB/s
Pod's disk read rate
Pods
k8s_pod_fs_read_bytes
B/s
Disk Read IOPS
Times/s
Number of I/O times Pod reads data from disk
Pods
k8s_pod_fs_read_times
Times/s
Disk Write IOPS
Times/s
Number of I/O times Pod writes data to disk
Pods
k8s_pod_fs_write_times
Times/s

Network metrics

Metric Name
in the Console
Unit
in the Console
Remarks
Type
metricName
Default Unit
Network bandwidth in
Mbps
Sum of inbound bandwidth of all containers per Pod
Pods
k8s_pod_network_receive_bytes_bw
Bps
Network bandwidth out
Mbps
Sum of outbound bandwidth of all containers per Pod
Pods
k8s_pod_network_transmit_bytes_bw
Bps
Network traffic in
KB
Sum of inbound traffic of all containers per Pod
Pods
k8s_pod_network_receive_bytes
B
Network traffic out
KB
Sum of outbound traffic of all containers per Pod
Pods
k8s_pod_network_transmit_bytes
B
Network packets in
Count/s
Sum of inbound packets of all containers per Pod
Pods
k8s_pod_network_receive_packets
Count/s
Network packets out
Count/s
Sum of outbound packets of all containers per Pod
Pods
k8s_pod_network_transmit_packets
Count/s

Memory metrics

Metric Name
in the Console
Unit
in the Console
Remarks
Type
metricName
Default Unit
Memory Usage
MiB
Amount of memory used by the Pod
Pods
k8s_pod_mem_usage_bytes
B
Memory Usage (excluding cache)
MiB
Pod memory usage, excluding cache
Pods
k8s_pod_mem_no_cache_bytes
B
Memory Utilization (per node)
%
Percentage of total memory of the node used by the Pod
Pods
k8s_pod_rate_mem_usage_node
%
Memory Utilization (per node, excluding cache)
%
Percentage of total memory of the node used by the Pod, excluding cache
Pods
k8s_pod_rate_mem_no_cache_node
%
Memory Utilization (per Request)
%
Percentage of total memory of the Request used by the Pod
Pods
k8s_pod_rate_mem_usage_request
%
Memory Utilization (per Request, excluding cache)
%
Percentage of total memory of the Request used by the Pod, excluding cache
Pods
k8s_pod_rate_mem_no_cache_request
%
Memory Utilization (per Limit)
%
Percentage of Pod memory usage to the Limit value
Pods
k8s_pod_rate_mem_usage_limit
%
Memory Utilization (per Limit, excluding cache)
%
Percentage of Pod memory usage to the Limit value, excluding cache
Pods
k8s_pod_rate_mem_no_cache_limit
%

GPU

Note:
The following GPU-related triggering metrics can only be used in TKE Serverless clusters.
Metric Name
in the Console
Unit
in the Console
Remarks
Type
metricName
Default Unit
GPU Usage
CUDA Core
Pod GPU usage
Pods
k8s_pod_gpu_used
CUDA Core
GPU Applications
CUDA Core
Pod GPU applications
Pods
k8s_pod_gpu_request
CUDA Core
GPU Utilization (per Request)
%
Percentage of GPU usage to the Request value
Pods
k8s_pod_rate_gpu_used_request
%
GPU Utilization (per node)
%
GPU usage percentage in the node
Pods
k8s_pod_rate_gpu_used_node
%
GPU Memory Usage
MiB
Pod GPU memory usage
Pods
k8s_pod_gpu_memory_used_bytes
B
GPU Memory Applications
MiB
Pod GPU memory applications
Pods
k8s_pod_gpu_memory_request_bytes
B
GPU Memory Utilization (per Request)
%
Percentage of GPU memory usage to the Request value
Pods
k8s_pod_rate_gpu_memory_used_request
%
GPU Memory Utilization (per node)
%
GPU memory usage percentage in the node
Pods
k8s_pod_rate_gpu_memory_used_node
%

Creating and Editing an HPA by Using a YAML File

You can create and edit an HPA by using a YAML file. The following example shows a configuration file that defines an HPA named "example". The HPA enables the system to trigger HPA for 1 or 2 Pods when the CPU usage reaches 1.
Note:
TKE is compatible with the native resource types.
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: example
namespace: default
labels:
qcloud-app: example
spec:
minReplicas: 1
maxReplicas: 2
metrics:
- type: Pods# Support using Resource
pods:
metricName: k8s_pod_cpu_core_used
targetAverageValue: "1"
scaleTargetRef:
apiVersion: apps/v1beta2
kind: Deployment
name: nginx

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support