@@ -8,28 +8,28 @@ weight: 30
8
8
<!-- overview -->
9
9
10
10
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 evicting Pods when Node resources are exceeded.
11
+ {{< glossary_tooltip text="Quality of Service (QoS) classes" term_id="qos-class" >}}.
12
+ Kubernetes uses QoS classes to make decisions about evicting Pods when Node resources are exceeded.
12
13
13
14
15
+ When Kubernetes creates a Pod it assigns one of these QoS classes to the Pod:
16
+
17
+ * [ Guaranteed] ( /docs/concepts/workloads/pods/pod-qos/#guaranteed )
18
+ * [ Burstable] ( /docs/concepts/workloads/pods/pod-qos/#burstable )
19
+ * [ BestEffort] ( /docs/concepts/workloads/pods/pod-qos/#besteffort )
14
20
15
21
16
22
## {{% heading "prerequisites" %}}
17
23
18
24
19
- {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
25
+ {{< include "task-tutorial-prereqs.md" >}}
20
26
27
+ You also need to be able to create and delete namespaces.
21
28
22
29
23
30
24
31
<!-- steps -->
25
32
26
- ## QoS classes
27
-
28
- When Kubernetes creates a Pod it assigns one of these QoS classes to the Pod:
29
-
30
- * Guaranteed
31
- * Burstable
32
- * BestEffort
33
33
34
34
## Create a namespace
35
35
@@ -42,7 +42,7 @@ kubectl create namespace qos-example
42
42
43
43
## Create a Pod that gets assigned a QoS class of Guaranteed
44
44
45
- For a Pod to be given a QoS class of Guaranteed:
45
+ For a Pod to be given a QoS class of ` Guaranteed ` :
46
46
47
47
* Every Container in the Pod must have a memory limit and a memory request.
48
48
* For every Container in the Pod, the memory limit must equal the memory request.
@@ -53,7 +53,7 @@ These restrictions apply to init containers and app containers equally.
53
53
[ Ephemeral containers] ( /docs/concepts/workloads/pods/ephemeral-containers/ )
54
54
cannot define resources so these restrictions do not apply.
55
55
56
- Here is the configuration file for a Pod that has one Container. The Container has a memory limit and a
56
+ Here is a manifest for a Pod that has one Container. The Container has a memory limit and a
57
57
memory request, both equal to 200 MiB. The Container has a CPU limit and a CPU request, both equal to 700 milliCPU:
58
58
59
59
{{< codenew file="pods/qos/qos-pod.yaml" >}}
@@ -70,7 +70,7 @@ View detailed information about the Pod:
70
70
kubectl get pod qos-demo --namespace=qos-example --output=yaml
71
71
```
72
72
73
- The output shows that Kubernetes gave the Pod a QoS class of Guaranteed. The output also
73
+ The output shows that Kubernetes gave the Pod a QoS class of ` Guaranteed ` . The output also
74
74
verifies that the Pod Container has a memory request that matches its memory limit, and it has
75
75
a CPU request that matches its CPU limit.
76
76
@@ -97,6 +97,9 @@ CPU limit, but does not specify a CPU request, Kubernetes automatically assigns
97
97
the limit.
98
98
{{< /note >}}
99
99
100
+ <!-- 4th level heading to suppress entry in nav -->
101
+ #### Clean up {#clean-up-guaranteed}
102
+
100
103
Delete your Pod:
101
104
102
105
` ` ` shell
@@ -105,12 +108,12 @@ kubectl delete pod qos-demo --namespace=qos-example
105
108
106
109
## Create a Pod that gets assigned a QoS class of Burstable
107
110
108
- A Pod is given a QoS class of Burstable if:
111
+ A Pod is given a QoS class of ` Burstable ` if:
109
112
110
- * The Pod does not meet the criteria for QoS class Guaranteed.
113
+ * The Pod does not meet the criteria for QoS class ` Guaranteed ` .
111
114
* At least one Container in the Pod has a memory or CPU request or limit.
112
115
113
- Here is the configuration file for a Pod that has one Container. The Container has a memory limit of 200 MiB
116
+ Here is a manifest for a Pod that has one Container. The Container has a memory limit of 200 MiB
114
117
and a memory request of 100 MiB.
115
118
116
119
{{< codenew file="pods/qos/qos-pod-2.yaml" >}}
@@ -127,7 +130,7 @@ View detailed information about the Pod:
127
130
kubectl get pod qos-demo-2 --namespace=qos-example --output=yaml
128
131
```
129
132
130
- The output shows that Kubernetes gave the Pod a QoS class of Burstable.
133
+ The output shows that Kubernetes gave the Pod a QoS class of ` Burstable ` :
131
134
132
135
``` yaml
133
136
spec :
@@ -145,6 +148,9 @@ status:
145
148
qosClass : Burstable
146
149
` ` `
147
150
151
+ <!-- 4th level heading to suppress entry in nav -->
152
+ #### Clean up {#clean-up-burstable}
153
+
148
154
Delete your Pod:
149
155
150
156
` ` ` shell
@@ -153,10 +159,10 @@ kubectl delete pod qos-demo-2 --namespace=qos-example
153
159
154
160
## Create a Pod that gets assigned a QoS class of BestEffort
155
161
156
- For a Pod to be given a QoS class of BestEffort, the Containers in the Pod must not
162
+ For a Pod to be given a QoS class of ` BestEffort ` , the Containers in the Pod must not
157
163
have any memory or CPU limits or requests.
158
164
159
- Here is the configuration file for a Pod that has one Container. The Container has no memory or CPU
165
+ Here is a manifest for a Pod that has one Container. The Container has no memory or CPU
160
166
limits or requests:
161
167
162
168
{{< codenew file="pods/qos/qos-pod-3.yaml" >}}
@@ -173,7 +179,7 @@ View detailed information about the Pod:
173
179
kubectl get pod qos-demo-3 --namespace=qos-example --output=yaml
174
180
```
175
181
176
- The output shows that Kubernetes gave the Pod a QoS class of BestEffort.
182
+ The output shows that Kubernetes gave the Pod a QoS class of ` BestEffort ` :
177
183
178
184
``` yaml
179
185
spec :
@@ -185,6 +191,9 @@ status:
185
191
qosClass : BestEffort
186
192
` ` `
187
193
194
+ <!-- 4th level heading to suppress entry in nav -->
195
+ #### Clean up {#clean-up-besteffort}
196
+
188
197
Delete your Pod:
189
198
190
199
` ` ` shell
@@ -193,13 +202,13 @@ kubectl delete pod qos-demo-3 --namespace=qos-example
193
202
194
203
## Create a Pod that has two Containers
195
204
196
- Here is the configuration file for a Pod that has two Containers. One container specifies a memory
205
+ Here is a manifest for a Pod that has two Containers. One container specifies a memory
197
206
request of 200 MiB. The other Container does not specify any requests or limits.
198
207
199
208
{{< codenew file="pods/qos/qos-pod-4.yaml" >}}
200
209
201
- Notice that this Pod meets the criteria for QoS class Burstable. That is, it does not meet the
202
- criteria for QoS class Guaranteed, and one of its Containers has a memory request.
210
+ Notice that this Pod meets the criteria for QoS class ` Burstable ` . That is, it does not meet the
211
+ criteria for QoS class ` Guaranteed ` , and one of its Containers has a memory request.
203
212
204
213
Create the Pod:
205
214
@@ -213,7 +222,7 @@ View detailed information about the Pod:
213
222
kubectl get pod qos-demo-4 --namespace=qos-example --output=yaml
214
223
```
215
224
216
- The output shows that Kubernetes gave the Pod a QoS class of Burstable:
225
+ The output shows that Kubernetes gave the Pod a QoS class of ` Burstable ` :
217
226
218
227
``` yaml
219
228
spec :
@@ -231,12 +240,19 @@ status:
231
240
qosClass : Burstable
232
241
` ` `
233
242
234
- Delete your Pod:
243
+ ## Retrieve the QoS class for a Pod
235
244
236
- ` ` ` shell
237
- kubectl delete pod qos-demo-4 --namespace=qos-example
245
+ Rather than see all the fields, you can view just the field you need:
246
+
247
+ ` ` ` bash
248
+ kubectl --namespace=qos-example get pod qos-demo-4 -o jsonpath='{ .status.qosClass}{"\n"}'
238
249
```
239
250
251
+ ``` none
252
+ Burstable
253
+ ```
254
+
255
+
240
256
## Clean up
241
257
242
258
Delete your namespace:
0 commit comments