Skip to content

Commit 9540a0f

Browse files
rohennesopenshift-cherrypick-robot
authored andcommitted
OCPBUGS:33247
1 parent 1d6c532 commit 9540a0f

File tree

1 file changed

+64
-23
lines changed

1 file changed

+64
-23
lines changed

modules/cnf-node-tuning-operator-creating-pod-with-guaranteed-qos-class.adoc

Lines changed: 64 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,43 @@
66
[id="cnf-node-tuning-operator-creating-pod-with-guaranteed-qos-class_{context}"]
77
= Creating a pod with a guaranteed QoS class
88

9-
Keep the following in mind when you create a pod that is given a QoS class of `Guaranteed`:
9+
You can create a pod with a quality of service (QoS) class of `Guaranteed` for high-performance workloads. Configuring a pod with a QoS class of `Guaranteed` ensures that the pod has priority access to the specified CPU and memory resources.
1010

11-
* Every container in the pod must have a memory limit and a memory request, and they must be the same.
12-
* Every container in the pod must have a CPU limit and a CPU request, and they must be the same.
11+
To create a pod with a QoS class of `Guaranteed`, you must apply the following specifications:
1312

14-
The following example shows the configuration file for a pod that has one container. The container has a memory limit and a memory request, both equal to 200 MiB. The container has a CPU limit and a CPU request, both equal to 1 CPU.
13+
* Set identical values for the memory limit and memory request fields for each container in the pod.
14+
* Set identical values for CPU limit and CPU request fields for each container in the pod.
1515
16+
In general, a pod with a QoS class of `Guaranteed` will not be evicted from a node. One exception is during resource contention caused by system daemons exceeding reserved resources. In this scenario, the `kubelet` might evict pods to preserve node stability, starting with the lowest priority pods.
17+
18+
.Prerequisites
19+
20+
* Access to the cluster as a user with the `cluster-admin` role
21+
22+
* The OpenShift CLI (`oc`)
23+
24+
.Procedure
25+
26+
. Create a namespace for the pod by running the following command:
27+
+
28+
[source,terminal]
29+
----
30+
$ oc create namespace qos-example <1>
31+
----
32+
<1> This example uses the `qos-example` namespace.
33+
+
34+
.Example output
35+
[source,terminal]
36+
----
37+
namespace/qos-example created
38+
----
39+
40+
. Create the `Pod` resource:
41+
42+
.. Create a YAML file that defines the `Pod` resource:
43+
+
44+
--
45+
.Example `qos-example.yaml` file
1646
[source,yaml]
1747
----
1848
apiVersion: v1
@@ -27,45 +57,56 @@ spec:
2757
type: RuntimeDefault
2858
containers:
2959
- name: qos-demo-ctr
30-
image: <image-pull-spec>
60+
image: quay.io/openshifttest/hello-openshift:openshift <1>
3161
resources:
3262
limits:
33-
memory: "200Mi"
34-
cpu: "1"
63+
memory: "200Mi" <2>
64+
cpu: "1" <3>
3565
requests:
36-
memory: "200Mi"
37-
cpu: "1"
66+
memory: "200Mi" <4>
67+
cpu: "1" <5>
3868
securityContext:
3969
allowPrivilegeEscalation: false
4070
capabilities:
4171
drop: [ALL]
4272
----
73+
<1> This example uses a public `hello-openshift` image.
74+
<2> Sets the memory limit to 200 MB.
75+
<3> Sets the CPU limit to 1 CPU.
76+
<4> Sets the memory request to 200 MB.
77+
<5> Sets the CPU request to 1 CPU.
78+
+
79+
[NOTE]
80+
====
81+
If you specify a memory limit for a container, but do not specify a memory request, {product-title} automatically assigns a memory request that matches the limit. Similarly, if you specify a CPU limit for a container, but do not specify a CPU request, {product-title} automatically assigns a CPU request that matches the limit.
82+
====
83+
--
4384

44-
. Create the pod:
85+
.. Create the `Pod` resource by running the following command:
4586
+
4687
[source,terminal]
4788
----
48-
$ oc apply -f qos-pod.yaml --namespace=qos-example
89+
$ oc apply -f qos-example.yaml --namespace=qos-example
90+
----
91+
+
92+
.Example output
93+
[source,terminal]
94+
----
95+
pod/qos-demo created
4996
----
5097

51-
. View detailed information about the pod:
98+
.Verification
99+
100+
* View the `qosClass` value for the pod by running the following command:
52101
+
53102
[source,terminal]
54103
----
55-
$ oc get pod qos-demo --namespace=qos-example --output=yaml
104+
$ oc get pod qos-demo --namespace=qos-example --output=yaml | grep qosClass
56105
----
57106
+
58107
.Example output
59108
[source,yaml]
60109
----
61-
spec:
62-
containers:
63-
...
64-
status:
65-
qosClass: Guaranteed
110+
qosClass: Guaranteed
66111
----
67-
+
68-
[NOTE]
69-
====
70-
If you specify a memory limit for a container, but do not specify a memory request, {product-title} automatically assigns a memory request that matches the limit. Similarly, if you specify a CPU limit for a container, but do not specify a CPU request, {product-title} automatically assigns a CPU request that matches the limit.
71-
====
112+

0 commit comments

Comments
 (0)