Kubernetes quality of service Qos resolve - Pod resource requests and limits how to configure?

QoSQuality of Service is the acronym for quality of service . In order to achieve effectively improve resource scheduling and allocation of resource utilization at the same time, kubernetesexpectations for different quality of service, to quality of service management pod through QoS (Quality of Service). For a pod, the quality of service in two specific indicators: CPU 和内存. When the node memory is tight, kubernetes will be dealt with accordingly different QoS classes set in advance.

QoS can be divided into Guaranteed、Burstable 和 Best-Effortthree categories, highest to lowest priority.

Guaranteed (guaranteed)

pod belonging to the level of the following two:

  • All containers and Pod are provided only in the CPU and memory limits
  • All containers are set in the pod and the CPU memory requests and limits, and within a single container requests==limits(not equal to 0 requests)

All containers are in the pod and only set limits:

containers:
  name: foo
    resources:
      limits:
        cpu: 10m
        memory: 1Gi
  name: bar
    resources:
      limits:
        cpu: 100m
        memory: 100Mi

All containers are set up in the pod and requests limits, and a single container requests==limits:

containers:
  name: foo
    resources:
      limits:
        cpu: 10m
        memory: 1Gi
      requests:
        cpu: 10m
        memory: 1Gi

  name: bar
    resources:
      limits:
        cpu: 100m
        memory: 100Mi
      requests:
        cpu: 100m
        memory: 100Mi

Container foo and bar requests resources within limits and are equal, QoS level of the pod belongs Guaranteed.

Burstable (unstable)

As long as there is a container the pod of requests and limits set are not the same, that is, QoS of the pod Burstable.

Foo container specified resource, and the container bar is not specified:

containers:
  name: foo
    resources:
      limits:
        cpu: 10m
        memory: 1Gi
      requests:
        cpu: 10m
        memory: 1Gi

  name: bar

Container foo set memory limits, and the container bar set CPU limits:

containers:
  name: foo
    resources:
      limits:
        memory: 1Gi

  name: bar
    resources:
      limits:
        cpu: 100m

Note: If the container requests specified without specifying limits, the limits of the maximum value is equal to resource node; if not specified container specified limits requests, the requests of equal limits.

Best-Effort (best effort)

If all the resources in the Pod containers provided no requests with limits, that is, QoS of the pod Best-Effort.

Foo and bar container vessels do not set requests and limits:

containers:
  name: foo
    resources:
  name: bar
    resources:

Resource recovery strategy based on QoS

Kubernetes through cgroupto the pod setting QoS level, when there is insufficient resources to killlower priority pod, in actual use, through OOMto fractional values, OOMthe score range 0-1000. OOM The score value OOM_ADJobtained parameter calculation.

For the Guaranteedlevel Pod, OOM_ADJ became -998 parameters for Best-Effortlevel Pod, OOM_ADJ parameters would be 1000, for the Burstablelevel Pod, OOM_ADJ parameter values from 2-999.

For kuberntes reserve resources, such as kubelet, docker, OOM_ADJ parameters became -999, that it would not be out OOM kill. The larger, higher OOM_ADJ parameters calculated from the OOM score, the lower the priority of the pod, when there is competition for resources would sooner kill off, for OOM_ADJ parameter is a kubernetes -999 never because OOM to kill off.

QoS pods kill off the scene with the order

  • Best-Effort pods: when the system is used up all the memory, the type pods will be the first to kill off.
  • Burstable pods: the system uses up all of the memory, and no Best-Effort type of container can be when the kill, the type of pods would kill off.
  • Guaranteed pods: the system uses up all of the memory, and no Burstable and Best-Effort type of container can be kill time, the type of pods would kill off.

QoS recommendations

If sufficient resources can be QoS pods are set to type Guaranteed. Changing service performance and stability of computational resources, time and cost reduction to troubleshoot. If you want to better improve resource utilization, business services can be set to Guaranteed, while others are based on the degree of importance may be set to Burstable or Best-Effort.

Guess you like

Origin www.cnblogs.com/weifeng1463/p/11244530.html