HPA Metrics

Last updated: 2020-07-03 15:09:18

    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. Such metrics include 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 provide details about some 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 ConsoleUnit in the ConsoleDescription typemetricNameDefault Unit
    CPU Usage Core Number of CPU cores used by the pod Pods k8s_pod_cpu_core_used Core
    CPU utilization
    (% of node)
    % Percentage of total CPU of the node used by the Pod Pods k8s_pod_rate_cpu_core_used_node %
    CPU Utilization
    (% of Request)
    % Percentage of the total number of CPU cores specified by Request that is used by the pod Pods k8s_pod_rate_cpu_core_used_request %
    CPU Utilization
    (% of Limit)
    % Percentage of the total number of CPU cores specified by Limit that is used by the pod Pods k8s_pod_rate_cpu_core_used_limit %

    Disk Metrics

    Metric Name in the ConsoleUnit in the ConsoleDescription typemetricNameDefault Unit
    Disk Write Traffic KB/s Pod’s disk write speed Pods k8s_pod_fs_write_bytes B/s
    Disk Read Traffic KB/s Pod’s disk read speed 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 ConsoleUnit in the ConsoleDescription typemetricNameDefault Unit
    Network Bandwidth In Mbps Sum of Pod’s ingress bandwidth Pods k8s_pod_network_receive_bytes_bw Bps
    Network Bandwidth Out Mbps Sum of Pod’s egress bandwidth Pods k8s_pod_network_transmit_bytes_bw Bps
    Network Traffic In KB/s Sum of Pod’s ingress traffic Pods k8s_pod_network_receive_bytes B/s
    Network Traffic Out KB/s Sum of Pod’s egress traffic Pods k8s_pod_network_transmit_bytes B/s
    Network Packets In Packets/s Sum of Pod’s inbound packets Pods k8s_pod_network_receive_packets Packets/s
    Network Packets Out Packets/s Sum of Pod’s outbound packets Pods k8s_pod_network_transmit_packets Packets/s

    Memory Metrics

    Metric Name in the ConsoleUnit in the ConsoleDescription typemetricNameDefault Unit
    MEM Usage Mib Amount of memory used by the pod Pods k8s_pod_mem_usage_bytes B
    MEM Usage
    (excluding cache)
    Mib Pod memory usage, excluding cache Pods k8s_pod_mem_no_cache_bytes B
    MEM utilization
    (% of node)
    % Percentage of total memory of the node used by the Pod Pods k8s_pod_rate_mem_usage_node %
    MEM utilization
    (% of node, excluding cache)
    % Percentage of total memory of the node used by the Pod, excluding cache Pods k8s_pod_rate_mem_no_cache_node %
    MEM Utilization
    (% of Request)
    % Percentage of the total amount of memory specified by Request that is used by the pod Pods k8s_pod_rate_mem_usage_request %
    Memory utilization
    (% of request, excluding cache)
    % Percentage of Pod memory usage to the request value, excluding cache Pods k8s_pod_rate_mem_no_cache_request %
    MEM Utilization
    (% of Limit)
    % Percentage of the total amount of memory specified by Limit that is used by the pod Pods k8s_pod_rate_mem_usage_limit %
    MEM utilization
    (% of limit, excluding cache)
    % Percentage of Pod memory usage to the limit value, excluding cache Pods k8s_pod_rate_mem_no_cache_limit %

    GPU Metrics

    Metric Name in the ConsoleUnit in the ConsoleDescription typemetricNameDefault 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
    (% of request)
    % Percentage of GPU usage to the request value Pods k8s_pod_rate_gpu_used_request %
    GPU utilization
    (% of node)
    % Percentage of node taken up by GPU usage 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
    (% of request)
    % Percentage of GPU memory usage to the request value Pods k8s_pod_rate_gpu_memory_used_request %
    GPU memory utilization
    (% of node)
    % Percentage of node taken up by GPU memory usage 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.

    apiVersion":"autoscaling/v2beta1
    kind:HorizontalPodAutoscaler
    metadata:
      name: example
      namespace: default
      labels:
        qcloud-app: example
    spec:
      minReplicas: 1
      maxReplicas: 2
      metrics:
      - type: Pods
        pods:
          metricName: k8s_pod_cpu_core_used
          targetAverageValue: "1"
      scaleTargetRef:
        apiVersion: apps/v1beta2
        kind: Deployment
        name: nginx

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help