Skip to content

Commit 7076e09

Browse files
authored
Merge pull request #49472 from mburke5678/nodes-cgroups-vs-tech-preview
OSDOCS#3977: Tech preview of cgroup V2
2 parents f7f4080 + 6983ccc commit 7076e09

12 files changed

+305
-157
lines changed

_topic_maps/_topic_map.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ Topics:
470470
File: installing-customizing
471471
- Name: Configuring your firewall
472472
File: configuring-firewall
473+
- Name: Enabling Linux control group version 2 (cgroup v2)
474+
File: enabling-cgroup-v2
473475
- Name: Validating an installation
474476
File: validating-an-installation
475477
Distros: openshift-origin,openshift-enterprise
@@ -2081,6 +2083,9 @@ Topics:
20812083
- Name: Configuring your cluster to place pods on overcommited nodes
20822084
File: nodes-cluster-overcommit
20832085
Distros: openshift-enterprise,openshift-origin
2086+
- Name: Enabling Linux control group version 2 (cgroup v2)
2087+
File: nodes-cluster-cgroups-2
2088+
Distros: openshift-enterprise,openshift-origin
20842089
- Name: Enabling features using FeatureGates
20852090
File: nodes-cluster-enabling-features
20862091
Distros: openshift-enterprise,openshift-origin
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
:_content-type: ASSEMBLY
2+
:context: nodes-cluster-cgroups-2
3+
[id="enabling-cgroup-v2"]
4+
= Enabling Linux control group version 2 (cgroup v2)
5+
include::_attributes/common-attributes.adoc[]
6+
7+
toc::[]
8+
9+
You can enable link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[Linux control group version 2] (cgroup v2) in your cluster by editing the `node.config` object. Enabling cgroup v2 in {product-title} disables all cgroups version 1 controllers and hierarchies in your cluster. cgroup v1 is enabled by default.
10+
11+
cgroup v2 is the next version of the Linux cgroup API. cgroup v2 offers several improvements over cgroup v1, including a unified hierarchy, safer sub-tree delegation, new features such as link:https://www.kernel.org/doc/html/latest/accounting/psi.html[Pressure Stall Information], and enhanced resource management and isolation.
12+
13+
:FeatureName: {product-title} cgroups version 2 support
14+
include::snippets/technology-preview.adoc[leveloffset=+0]
15+
16+
// The following include statements pull in the module files that comprise
17+
// the assembly. Include any combination of concept, procedure, or reference
18+
// modules required to cover the user story. You can also include other
19+
// assemblies.
20+
21+
22+
include::modules/nodes-clusters-cgroups-2-install.adoc[leveloffset=+1]
23+
24+
.Additional resources
25+
26+
* xref:../../nodes/clusters/nodes-cluster-enabling-features.adoc#nodes-cluster-enabling[Enabling OpenShift Container Platform features using FeatureGates]
27+
* xref:../../installing/index.adoc#ocp-installation-overview[OpenShift Container Platform installation overview]

modules/installation-configuration-parameters.adoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,6 @@ Optional installation configuration parameters are described in the following ta
456456
|Extends the set of optional capabilities beyond what you specify in `baselineCapabilitySet`. Valid values are `baremetal`, `marketplace` and `openshift-samples`. You may specify multiple capabilities in this parameter.
457457
|String array
458458

459-
|`cgroupsV2`
460-
|Enables link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[Linux control groups version 2] (cgroups v2) on specific nodes in your cluster. The {product-title} process for enabling cgroups v2 disables all cgroup version 1 controllers and hierarchies. The {product-title} cgroups version 2 feature is in Developer Preview and is not supported by Red Hat at this time.
461-
|`true`
462-
463459
|`compute`
464460
|The configuration for the machines that comprise the compute nodes.
465461
|Array of `MachinePool` objects.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * install/install_config/enabling-cgroup-v2
4+
5+
:_content-type: PROCEDURE
6+
[id="nodes-clusters-cgroups-2-install_{context}"]
7+
= Enabling Linux cgroup v2 during installation
8+
9+
You can enable Linux control group version 2 (cgroup v2) when you install a cluster by creating installation manifests.
10+
11+
.Procedure
12+
13+
. Create or edit the `node.config` object to specify the `v2` cgroup:
14+
+
15+
[source,yaml]
16+
----
17+
apiVersion: config.openshift.io/v1
18+
kind: Node
19+
metadata:
20+
name: cluster
21+
spec:
22+
cgroupMode: "v2"
23+
----
24+
25+
. Create or edit the `FeatureGate` object to enable the `TechPreviewNoUpgrade` feature set:
26+
+
27+
[source,yaml]
28+
----
29+
apiVersion: config.openshift.io/v1
30+
kind: FeatureGate
31+
metadata:
32+
name: cluster
33+
spec:
34+
featureSet: "TechPreviewNoUpgrade"
35+
----
36+
37+
. Proceed with the installation as usual.
38+

modules/nodes-clusters-cgroups-2.adoc

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/clusters/nodes-cluster-cgroups-2.adoc
4+
// * post_installation_configuration/machine-configuration-tasks.adoc
5+
6+
ifeval::["{context}" == "nodes-cluster-cgroups-2"]
7+
:nodes:
8+
endif::[]
9+
ifeval::["{context}" == "post-install-cluster-tasks"]
10+
:post:
11+
endif::[]
12+
13+
:_content-type: PROCEDURE
14+
[id="nodes-clusters-cgroups-2_{context}"]
15+
= Configuring Linux cgroup v2
16+
17+
ifdef::post[]
18+
You can enable link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[Linux control group version 2] (cgroup v2) in your cluster by editing the `node.config` object. Enabling cgroup v2 in {product-title} disables all cgroups version 1 controllers and hierarchies in your cluster. cgroup v1 is enabled by default.
19+
20+
cgroup v2 is the next version of the Linux cgroup API. cgroup v2 offers several improvements over cgroup v1, including a unified hierarchy, safer sub-tree delegation, new features such as link:https://www.kernel.org/doc/html/latest/accounting/psi.html[Pressure Stall Information], and enhanced resource management and isolation.
21+
22+
[IMPORTANT]
23+
====
24+
{product-title} cgroups version 2 support is a Technology Preview feature only. Technology Preview features
25+
are not supported with Red Hat production service level agreements (SLAs) and
26+
might not be functionally complete. Red Hat does not recommend using them
27+
in production. These features provide early access to upcoming product
28+
features, enabling customers to test functionality and provide feedback during
29+
the development process.
30+
31+
For more information about the support scope of Red Hat Technology Preview
32+
features, see https://access.redhat.com/support/offerings/techpreview/.
33+
====
34+
endif::post[]
35+
36+
ifdef::nodes[]
37+
You enable cgroup v2 by editing the `node.config` object.
38+
endif::nodes[]
39+
40+
.Prerequisites
41+
* You have a running {product-title} cluster that uses version 4.12 or later.
42+
* You are logged in to the cluster as a user with administrative privileges.
43+
* You have enabled the `TechPreviewNoUpgrade` feature set by using the feature gates.
44+
45+
.Procedure
46+
47+
. Enable cgroup v2 on nodes:
48+
49+
.. Edit the `node.config` object:
50+
+
51+
[source,terminal]
52+
----
53+
$ oc edit nodes.config/cluster
54+
----
55+
56+
.. Add `spec.cgroupMode: "v2"`:
57+
+
58+
.Example `node.config` object
59+
[source,yaml]
60+
----
61+
apiVersion: config.openshift.io/v1
62+
kind: Node
63+
metadata:
64+
annotations:
65+
include.release.openshift.io/ibm-cloud-managed: "true"
66+
include.release.openshift.io/self-managed-high-availability: "true"
67+
include.release.openshift.io/single-node-developer: "true"
68+
release.openshift.io/create-only: "true"
69+
creationTimestamp: "2022-07-08T16:02:51Z"
70+
generation: 1
71+
name: cluster
72+
ownerReferences:
73+
- apiVersion: config.openshift.io/v1
74+
kind: ClusterVersion
75+
name: version
76+
uid: 36282574-bf9f-409e-a6cd-3032939293eb
77+
resourceVersion: "1865"
78+
uid: 0c0f7a4c-4307-4187-b591-6155695ac85b
79+
spec:
80+
cgroupMode: "v2" <1>
81+
...
82+
----
83+
<1> Enables cgroup v2.
84+
85+
86+
.Verification
87+
88+
. Check the machine configs to see that the new machine configs were added:
89+
+
90+
[source,terminal]
91+
----
92+
$ oc get mc
93+
----
94+
+
95+
.Example output
96+
[source,terminal]
97+
----
98+
NAME GENERATEDBYCONTROLLER IGNITIONVERSION AGE
99+
00-master 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
100+
00-worker 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
101+
01-master-container-runtime 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
102+
01-master-kubelet 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
103+
01-worker-container-runtime 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
104+
01-worker-kubelet 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
105+
97-master-generated-kubelet 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 3m <1>
106+
99-worker-generated-kubelet 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 3m
107+
99-master-generated-registries 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
108+
99-master-ssh 3.2.0 40m
109+
99-worker-generated-registries 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
110+
99-worker-ssh 3.2.0 40m
111+
rendered-master-23e785de7587df95a4b517e0647e5ab7 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
112+
rendered-worker-5d596d9293ca3ea80c896a1191735bb1 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
113+
worker-enable-cgroups-v2 3.2.0 10s
114+
----
115+
<1> New machine configs are created, as expected.
116+
117+
. Check that the new `kernelArguments` were added to the new machine configs:
118+
+
119+
[source,terminal]
120+
----
121+
$ oc describe mc <name>
122+
----
123+
+
124+
.Example output
125+
[source,terminal]
126+
----
127+
apiVersion: machineconfiguration.openshift.io/v1
128+
kind: MachineConfig
129+
metadata:
130+
labels:
131+
machineconfiguration.openshift.io/role: worker
132+
name: 05-worker-kernelarg-selinuxpermissive
133+
spec:
134+
kernelArguments:
135+
- systemd_unified_cgroup_hierarchy=1 <1>
136+
- cgroup_no_vi="all" <2>
137+
- psi=1 <3>
138+
----
139+
<1> Enables cgroup v2 in systemd.
140+
<2> Disables cgroups v1.
141+
<3> Enables the Linux Pressure Stall Information (PSI) feature.
142+
143+
. Check the nodes to see that scheduling on the nodes is disabled. This indicates that the change is being applied:
144+
+
145+
[source,terminal]
146+
----
147+
$ oc get nodes
148+
----
149+
+
150+
.Example output
151+
[source,terminal]
152+
----
153+
NAME STATUS ROLES AGE VERSION
154+
ci-ln-fm1qnwt-72292-99kt6-master-0 Ready master 58m v1.24.0
155+
ci-ln-fm1qnwt-72292-99kt6-master-1 Ready master 58m v1.24.0
156+
ci-ln-fm1qnwt-72292-99kt6-master-2 Ready master 58m v1.24.0
157+
ci-ln-fm1qnwt-72292-99kt6-worker-a-h5gt4 Ready,SchedulingDisabled worker 48m v1.24.0
158+
ci-ln-fm1qnwt-72292-99kt6-worker-b-7vtmd Ready worker 48m v1.24.0
159+
ci-ln-fm1qnwt-72292-99kt6-worker-c-rhzkv Ready worker 48m v1.24.0
160+
----
161+
162+
. After a node returns to the `Ready` state, start a debug session for that node:
163+
+
164+
[source,terminal]
165+
----
166+
$ oc debug node/<node_name>
167+
----
168+
169+
. Set `/host` as the root directory within the debug shell:
170+
+
171+
[source,terminal]
172+
----
173+
sh-4.4# chroot /host
174+
----
175+
176+
. Check that the `sys/fs/cgroup/cgroup2fs` file is present on your nodes. This file is created by cgroup v2:
177+
+
178+
[source,terminal]
179+
----
180+
$ stat -c %T -f /sys/fs/cgroup
181+
----
182+
+
183+
.Example output
184+
[source,terminal]
185+
----
186+
cgroup2fs
187+
----
188+
189+
ifeval::["{context}" == "nodes-cluster-cgroups-2"]
190+
:!nodes:
191+
endif::[]
192+
ifeval::["{context}" == "post-install-cluster-tasks"]
193+
:!post:
194+
endif::[]

0 commit comments

Comments
 (0)