Automatic telescopic Metric description

Last updated: 2020-02-14 15:46:39

PDF

Instance (Pod) automatic expansion and reduction ((Horizontal Pod Autoscaler,HPA) can automatically expand or reduce the number of service Pod based on the aPCge CPU utilization of the target instance, such as Metric. When automatic capacity expansion and reduction, the trigger Metric types that can be set in the console include CPU Metric, memory, hard disk, network and GPU-related Metric. In addition, these Metric can also be used when you create and edit a HPA from a YAML file, which is an example of configuring a YAML file.

Automatic telescopic Metric

The details of automatic scaling Metric are shown in the following table:

In the following auto-telescopic Metric details table, metricName The variables in have their own units, the default units shown in the table, which can be ignored when writing YAML files.

CPU Metric

Name of Metric (console)Unit (console)NoteTypeMetricNameDefault unit
CPU usagecoreCPU usage of PodPodsK8s_pod_cpu_core_usedcore
CPU Utilization
(accounts for Pod specifications)
%The ratio of CPU usage of Pod to the total amount of CPU of Pod AssignPodsK8s_pod_rate_cpu_core_used_resource%
CPU Utilization
(account for Request)
%The ratio of the CPU usage of the Pod to the set Request valuePodsK8s_pod_rate_cpu_core_used_request%
CPU Utilization
(account for Limit)
%The ratio of the CPU usage of the Pod to the set Limit valuePodsK8s_pod_rate_cpu_core_used_limit%

MEM

Name of Metric (console)Unit (console)NoteTypeMetricNameDefault unit
Memory usageMibPod memory usagePodsK8s_pod_mem_usage_bytesB
Memory utilization ratio
(accounts for Pod specifications)
%The proportion of Pod memory usage to Pod AssignPodsK8s_pod_rate_mem_usage_bytes_resource%
Memory utilization ratio
(account for Request)
%Pod memory usage as a percentage of RequestPodsK8s_pod_rate_mem_usage_request%
Memory utilization ratio
(account for Limit)
%Pod memory usage as a percentage of limitPodsK8s_pod_rate_mem_usage_limit%

Edit and create HPA through YAML

You can create and edit HPA from the YAML file. The following is an example of a configuration file that defines a HPA, CPU usage of 1 that triggers HPA named test, with an instance range of 1-2.

{
    "kind":"HorizontalPodAutoscaler",
    "apiVersion":"autoscaling/v2beta1",
    "metadata":{
        "name":"ccc",
        "namespace":"kube-system",
        "labels":{
            "qcloud-app":"ccc"
        }
    },
    "spec":{
        "minReplicas":1,
        "maxReplicas":2,
        "metrics":[
            {
                "type":"Pods",
                "pods":{
                    "metricName":"k8s_pod_cpu_core_used",
                    "targetAverageValue":"1"
                }
            }
        ],
        "scaleTargetRef":{
            "apiVersion":"apps/v1beta2",
            "kind":"Deployment",
            "name":"cbs-provisioner"
        }
    }
}