Skip to content

Commit 47ced50

Browse files
authored
Merge pull request #39118 from dshebib/qos_detail
Clarify QOS class effect
2 parents 4616b12 + 04ce79a commit 47ced50

File tree

4 files changed

+120
-3
lines changed

4 files changed

+120
-3
lines changed

content/en/docs/concepts/configuration/manage-resources-containers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,4 +807,5 @@ memory limit (and possibly request) for that container.
807807
and its [resource requirements](/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources)
808808
* Read about [project quotas](https://xfs.org/index.php/XFS_FAQ#Q:_Quota:_Do_quotas_work_on_XFS.3F) in XFS
809809
* Read more about the [kube-scheduler configuration reference (v1beta3)](/docs/reference/config-api/kube-scheduler-config.v1beta3/)
810+
* Read more about [Quality of Service classes for Pods](/docs/concepts/workloads/pods/pod-quality/)
810811

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
title: Pod Quality of Service Classes
3+
content_type: concept
4+
weight: 30
5+
---
6+
7+
<!-- overview -->
8+
9+
This page introduces _Quality of Service (QoS) classes_ in Kubernetes, and explains
10+
how Kubernetes assigns a QoS class to each Pods as a consequence of the resource
11+
constraints that you specify for the containers in that Pod. Kubernetes relies on this
12+
classification to make decisions about which Pods to evict when there are not enough
13+
available resources on a Node.
14+
15+
<!-- body -->
16+
17+
## Quality of Service classes
18+
19+
Kubernetes classifies the Pods that you run and allocates each Pod into a specific
20+
_quality of service (QoS) class_. Kubernetes uses that classification to influence how different
21+
pods are handled. Kubernetes does this classification based on the
22+
[resource requests](/docs/concepts/configuration/manage-resources-containers/)
23+
of the {{< glossary_tooltip text="Containers" term_id="container" >}} in that Pod, along with
24+
how those requests relate to resource limits.
25+
This is known as {{< glossary_tooltip text="Quality of Service" term_id="qos-class" >}}
26+
(QoS) class. Kubernetes assigns every Pod a QoS class based on the resource requests
27+
and limits of its component Containers. QoS classes are used by Kubernetes to decide
28+
which Pods to evict from a Node experiencing
29+
[Node Pressure](/docs/concepts/scheduling-eviction/node-pressure-eviction/). The possible
30+
QoS classes are `Guaranteed`, `Burstable`, and `BestEffort`. When a Node runs out of resources,
31+
Kubernetes will first evict `BestEffort` Pods running on that Node, followed by `Burstable` and
32+
finally `Guaranteed` Pods. When this eviction is due to resource pressure, only Pods exceeding
33+
resource requests are candidates for eviction.
34+
35+
### Guaranteed
36+
37+
Pods that are `Guaranteed` have the strictest resource limits and are least likely
38+
to face eviction. They are guaranteed not to be killed until they exceed their limits
39+
or there are no lower-priority Pods that can be preempted from the Node. They may
40+
not acquire resources beyond their specified limits. These Pods can also make
41+
use of exclusive CPUs using the
42+
[`static`](/docs/tasks/administer-cluster/cpu-management-policies/#static-policy) CPU management policy.
43+
44+
#### Criteria
45+
46+
For a Pod to be given a QoS class of `Guaranteed`:
47+
48+
* Every Container in the Pod must have a memory limit and a memory request.
49+
* For every Container in the Pod, the memory limit must equal the memory request.
50+
* Every Container in the Pod must have a CPU limit and a CPU request.
51+
* For every Container in the Pod, the CPU limit must equal the CPU request.
52+
53+
### Burstable
54+
55+
Pods that are `Burstable` have some lower-bound resource guarantees based on the request, but
56+
do not require a specific limit. If a limit is not specified, it defaults to a
57+
limit equivalent to the capacity of the Node, which allows the Pods to flexibly increase
58+
their resources if resources are available. In the event of Pod eviction due to Node
59+
resource pressure, these Pods are evicted only after all `BestEffort` Pods are evicted.
60+
Because a `Burstable` Pod can include a Container that has no resource limits or requests, a Pod
61+
that is `Burstable` can try to use any amount of node resources.
62+
63+
#### Criteria
64+
65+
A Pod is given a QoS class of `Burstable` if:
66+
67+
* The Pod does not meet the criteria for QoS class `Guaranteed`.
68+
* At least one Container in the Pod has a memory or CPU request or limit.
69+
70+
### BestEffort
71+
72+
Pods in the `BestEffort` QoS class can use node resources that aren't specifically assigned
73+
to Pods in other QoS classes. For example, if you have a node with 16 CPU cores available to the
74+
kubelet, and you assign assign 4 CPU cores to a `Guaranteed` Pod, then a Pod in the `BestEffort`
75+
QoS class can try to use any amount of the remaining 12 CPU cores.
76+
77+
The kubelet prefers to evict `BestEffort` Pods if the node comes under resource pressure.
78+
79+
#### Criteria
80+
81+
A Pod has a QoS class of `BestEffort` if it doesn't meet the criteria for either `Guaranteed`
82+
or `Burstable`. In other words, a Pod is `BestEffort` only if none of the Containers in the Pod have a
83+
memory limit or a memory request, and none of the Containers in the Pod have a
84+
CPU limit or a CPU request.
85+
Containers in a Pod can request other resources (not CPU or memory) and still be classified as
86+
`BestEffort`.
87+
88+
## Some behavior is independent of QoS class {#class-independent-behavior}
89+
90+
Certain behavior is independent of the QoS class assigned by Kubernetes. For example:
91+
92+
* Any Container exceeding a resource limit will be killed and restarted by the kubelet without
93+
affecting other Containers in that Pod.
94+
95+
* If a Container exceeds its resource request and the node it runs on faces
96+
resource pressure, the Pod it is in becomes a candidate for [eviction](/docs/concepts/scheduling-eviction/node-pressure-eviction/).
97+
If this occurs, all Containers in the Pod will be terminated. Kubernetes may create a
98+
replacement Pod, usually on a different node.
99+
100+
* The resource request of a Pod is equal to the sum of the resource requests of
101+
its component Containers, and the resource limit of a Pod is equal to the sum of
102+
the resource limits of its component Containers.
103+
104+
* The kube-scheduler does not consider QoS class when selecting which Pods to
105+
[preempt](/docs/concepts/scheduling-eviction/pod-priority-preemption/#preemption).
106+
Preemption can occur when a cluster does not have enough resources to run all the Pods
107+
you defined.
108+
109+
## {{% heading "whatsnext" %}}
110+
111+
* Learn about [resource management for Pods and Containers](/docs/concepts/configuration/manage-resources-containers/).
112+
* Learn about [Node-pressure eviction](/docs/concepts/scheduling-eviction/node-pressure-eviction/).
113+
* Learn about [Pod priority and preemption](/docs/concepts/scheduling-eviction/pod-priority-preemption/).
114+
* Learn about [Pod disruptions](/docs/concepts/workload/pods/disruptions/).
115+
* Learn how to [assign memory resources to containers and pods](/docs/tasks/configure-pod-container/assign-memory-resource/).
116+
* Learn how to [assign CPU resources to containers and pods](/docs/tasks/configure-pod-container/assign-cpu-resource/).
117+
* Learn how to [configure Quality of Service for Pods](/docs/tasks/configure-pod-container/quality-service-pod/).

content/en/docs/reference/glossary/qos-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: QoS Class
33
id: qos-class
44
date: 2019-04-15
5-
full_link:
5+
full_link: /docs/concepts/workloads/pods/pod-quality/
66
short_description: >
77
QoS Class (Quality of Service Class) provides a way for Kubernetes to classify pods within the cluster into several classes and make decisions about scheduling and eviction.
88

content/en/docs/tasks/configure-pod-container/quality-service-pod.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ weight: 30
88
<!-- overview -->
99

1010
This page shows how to configure Pods so that they will be assigned particular
11-
Quality of Service (QoS) classes. Kubernetes uses QoS classes to make decisions about
12-
scheduling and evicting Pods.
11+
Quality of Service (QoS) classes. Kubernetes uses QoS classes to make decisions about evicting Pods when Node resources are exceeded.
1312

1413

1514

0 commit comments

Comments
 (0)