Skip to content

Commit 65f5c86

Browse files
committed
OCPBUGS:33247
1 parent e54e381 commit 65f5c86

File tree

1 file changed

+72
-23
lines changed

1 file changed

+72
-23
lines changed

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

+72-23
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,51 @@
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 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+
[NOTE]
17+
====
18+
A pod with a QoS class of `Guaranteed` cannot use resources beyond the specified limits.
19+
====
20+
21+
The pod will not be evicted from a node unless one of the following criteria is met:
22+
23+
* During resource contention on a node, there are no lower-priority pods that can be evicted.
24+
* The pod exceeds the CPU or memory limits.
25+
26+
.Prerequisites
27+
28+
* Access to the cluster as a user with the `cluster-admin` role.
29+
30+
* The OpenShift CLI (`oc`) installed.
31+
32+
.Procedure
33+
34+
. Create a namespace for the pod by running the following command:
35+
+
36+
[source,terminal]
37+
----
38+
$ oc create namespace qos-example <1>
39+
----
40+
<1> This example uses the `qos-example` namespace.
41+
+
42+
.Example output
43+
[source,terminal]
44+
----
45+
namespace/qos-example created
46+
----
47+
48+
. Create the `Pod` resource:
49+
50+
.. Create a YAML file the defines the `Pod` resource:
51+
+
52+
--
53+
.Example `qos-example.yaml` file
1654
[source,yaml]
1755
----
1856
apiVersion: v1
@@ -27,45 +65,56 @@ spec:
2765
type: RuntimeDefault
2866
containers:
2967
- name: qos-demo-ctr
30-
image: <image-pull-spec>
68+
image: quay.io/openshifttest/hello-openshift:openshift <1>
3169
resources:
3270
limits:
33-
memory: "200Mi"
34-
cpu: "1"
71+
memory: "200Mi" <2>
72+
cpu: "1" <3>
3573
requests:
36-
memory: "200Mi"
37-
cpu: "1"
74+
memory: "200Mi" <4>
75+
cpu: "1" <5>
3876
securityContext:
3977
allowPrivilegeEscalation: false
4078
capabilities:
4179
drop: [ALL]
4280
----
81+
<1> This example uses a public `hello-openshift` image. Replace with the image that you want to use for your workload.
82+
<2> This example sets the memory limit to 200MB.
83+
<3> This example sets the CPU limit to one CPU.
84+
<4> This example sets the memory request to 200MB.
85+
<5> This example sets the CPU request to one CPU.
86+
+
87+
[NOTE]
88+
====
89+
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.
90+
====
91+
--
4392

44-
. Create the pod:
93+
.. Create the `Pod` resource by running the following command:
94+
+
95+
[source,terminal]
96+
----
97+
$ oc apply -f qos-example.yaml --namespace=qos-example
98+
----
4599
+
100+
.Example output
46101
[source,terminal]
47102
----
48-
$ oc apply -f qos-pod.yaml --namespace=qos-example
103+
pod/qos-demo created
49104
----
50105

51-
. View detailed information about the pod:
106+
.Verification
107+
108+
* View the `qosClass` value for the pod by running the following command:
52109
+
53110
[source,terminal]
54111
----
55-
$ oc get pod qos-demo --namespace=qos-example --output=yaml
112+
$ oc get pod qos-demo --namespace=qos-example --output=yaml | grep qosClass
56113
----
57114
+
58115
.Example output
59116
[source,yaml]
60117
----
61-
spec:
62-
containers:
63-
...
64-
status:
65-
qosClass: Guaranteed
118+
qosClass: Guaranteed
66119
----
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-
====
120+

0 commit comments

Comments
 (0)