Skip to content

Commit effb926

Browse files
authored
Merge pull request #56436 from mburke5678/nodes-cgroup-v2-ga
OSDOCS#5056: GA CgroupV2 in Openshift 4.13
2 parents ee1afa5 + 601f2c5 commit effb926

File tree

9 files changed

+128
-57
lines changed

9 files changed

+128
-57
lines changed

_topic_maps/_topic_map.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ Topics:
508508
File: configuring-firewall
509509
- Name: Enabling Linux control group version 2 (cgroup v2)
510510
File: enabling-cgroup-v2
511+
Distros: openshift-enterprise
511512
- Name: Validating an installation
512513
File: validating-an-installation
513514
Distros: openshift-origin,openshift-enterprise
@@ -2274,10 +2275,10 @@ Topics:
22742275
- Name: Configuring your cluster to place pods on overcommited nodes
22752276
File: nodes-cluster-overcommit
22762277
Distros: openshift-enterprise,openshift-origin
2277-
- Name: Enabling Linux control group version 2 (cgroup v2)
2278+
- Name: Configuring the Linux cgroup version on your nodes
22782279
File: nodes-cluster-cgroups-2
22792280
Distros: openshift-enterprise
2280-
- Name: Configuring the Linux cgroup on your nodes
2281+
- Name: Configuring the Linux cgroup version on your nodes
22812282
File: nodes-cluster-cgroups-okd
22822283
Distros: openshift-origin
22832284
- Name: Enabling features using FeatureGates

installing/install_config/enabling-cgroup-v2.adoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ toc::[]
88

99

1010
ifndef::openshift-origin[]
11-
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.
11+
By default, {product-title} uses link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1.html[Linux control group version 1] (cgroup v1) in your cluster. You can enable link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[Linux control group version 2] (cgroup v2) upon installation. Enabling cgroup v2 in {product-title} disables all cgroup version 1 controllers and hierarchies in your cluster.
1212

1313
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.
1414

15-
:FeatureName: {product-title} cgroups version 2 support
16-
include::snippets/technology-preview.adoc[leveloffset=+0]
15+
You can switch between cgroup v1 and cgroup v2, as needed, by editing the the `node.config` object. For more information, see "Configuring the Linux cgroup on your nodes" in the "Additional resources" of this section.
1716
endif::openshift-origin[]
1817

1918
ifdef::openshift-origin[]
@@ -37,5 +36,5 @@ endif::openshift-origin[]
3736

3837
.Additional resources
3938

40-
* xref:../../nodes/clusters/nodes-cluster-enabling-features.adoc#nodes-cluster-enabling[Enabling OpenShift Container Platform features using FeatureGates]
4139
* xref:../../installing/index.adoc#ocp-installation-overview[OpenShift Container Platform installation overview]
40+
* xref:../../nodes/clusters/nodes-cluster-cgroups-2.adoc#nodes-clusters-cgroups-2_nodes-cluster-cgroups-2[Configuring the Linux cgroup on your nodes]

modules/nodes-clusters-cgroups-2-install.adoc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,5 @@ metadata:
2222
cgroupMode: "v2"
2323
----
2424

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-
3725
. Proceed with the installation as usual.
3826

modules/nodes-clusters-cgroups-2.adoc

Lines changed: 84 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,23 @@ endif::[]
1212

1313
:_content-type: PROCEDURE
1414
[id="nodes-clusters-cgroups-2_{context}"]
15-
= Configuring Linux cgroup v2
15+
= Configuring Linux cgroup
1616

1717
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.
18+
link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[Linux control group version 1] (cgroup v1) is enabled by default. 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 cgroup version 1 controllers and hierarchies in your cluster.
1919

2020
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.
2121

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 features, see link:https://access.redhat.com/support/offerings/techpreview/[Technology Preview Features Support Scope].
32-
====
22+
You can change between cgroup v1 and cgroup v2, as needed. For more information, see "Configuring the Linux cgroup on your nodes" in the "Additional resources" of this section.
3323
endif::post[]
3424

3525
ifdef::nodes[]
36-
You enable cgroup v2 by editing the `node.config` object.
26+
You can enable link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1.html[Linux control group version 1] (cgroup v1) or link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[Linux control group version 2] (cgroup v2) by editing the `node.config` object. The default is cgroup v1.
3727
endif::nodes[]
3828

3929
.Prerequisites
4030
* You have a running {product-title} cluster that uses version 4.12 or later.
4131
* You are logged in to the cluster as a user with administrative privileges.
42-
* You have enabled the `TechPreviewNoUpgrade` feature set by using the feature gates.
4332
4433
.Procedure
4534

@@ -52,6 +41,7 @@ endif::nodes[]
5241
$ oc edit nodes.config/cluster
5342
----
5443

44+
ifdef::post[]
5545
.. Add `spec.cgroupMode: "v2"`:
5646
+
5747
.Example `node.config` object
@@ -80,7 +70,38 @@ spec:
8070
...
8171
----
8272
<1> Enables cgroup v2.
73+
endif::post[]
8374

75+
ifdef::nodes[]
76+
.. Edit the `spec.cgroupMode` parameter:
77+
+
78+
.Example `node.config` object
79+
[source,yaml]
80+
----
81+
apiVersion: config.openshift.io/v1
82+
kind: Node
83+
metadata:
84+
annotations:
85+
include.release.openshift.io/ibm-cloud-managed: "true"
86+
include.release.openshift.io/self-managed-high-availability: "true"
87+
include.release.openshift.io/single-node-developer: "true"
88+
release.openshift.io/create-only: "true"
89+
creationTimestamp: "2022-07-08T16:02:51Z"
90+
generation: 1
91+
name: cluster
92+
ownerReferences:
93+
- apiVersion: config.openshift.io/v1
94+
kind: ClusterVersion
95+
name: version
96+
uid: 36282574-bf9f-409e-a6cd-3032939293eb
97+
resourceVersion: "1865"
98+
uid: 0c0f7a4c-4307-4187-b591-6155695ac85b
99+
spec:
100+
cgroupMode: "v2" <1>
101+
...
102+
----
103+
<1> Specify `v2` to enable cgroup v2 or `v1` for cgroup v1.
104+
endif::nodes[]
84105

85106
.Verification
86107

@@ -101,15 +122,16 @@ NAME GENERATEDBYCONTROLLER
101122
01-master-kubelet 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
102123
01-worker-container-runtime 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
103124
01-worker-kubelet 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
104-
97-master-generated-kubelet 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 3m <1>
105-
99-worker-generated-kubelet 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 3m
125+
97-master-generated-kubelet 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
126+
99-worker-generated-kubelet 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
106127
99-master-generated-registries 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
107128
99-master-ssh 3.2.0 40m
108129
99-worker-generated-registries 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
109130
99-worker-ssh 3.2.0 40m
131+
rendered-master-23d4317815a5f854bd3553d689cfe2e9 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 10s <1>
110132
rendered-master-23e785de7587df95a4b517e0647e5ab7 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
111133
rendered-worker-5d596d9293ca3ea80c896a1191735bb1 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 33m
112-
worker-enable-cgroups-v2 3.2.0 10s
134+
rendered-worker-dcc7f1b92892d34db74d6832bcc9ccd4 52dd3ba6a9a527fc3ab42afac8d12b693534c8c9 3.2.0 10s
113135
----
114136
<1> New machine configs are created, as expected.
115137

@@ -120,7 +142,26 @@ worker-enable-cgroups-v2
120142
$ oc describe mc <name>
121143
----
122144
+
123-
.Example output
145+
ifdef::nodes[]
146+
.Example output for cgroup v1
147+
[source,terminal]
148+
----
149+
apiVersion: machineconfiguration.openshift.io/v1
150+
kind: MachineConfig
151+
metadata:
152+
labels:
153+
machineconfiguration.openshift.io/role: worker
154+
name: 05-worker-kernelarg-selinuxpermissive
155+
spec:
156+
kernelArguments:
157+
systemd.unified_cgroup_hierarchy=0 <1>
158+
systemd.legacy_systemd_cgroup_controller=1 <2>
159+
----
160+
<1> Enables cgroup v1 in systemd.
161+
<2> Disables cgroup v2.
162+
+
163+
endif::nodes[]
164+
.Example output for cgroup v2
124165
[source,terminal]
125166
----
126167
apiVersion: machineconfiguration.openshift.io/v1
@@ -136,7 +177,7 @@ spec:
136177
- psi=1 <3>
137178
----
138179
<1> Enables cgroup v2 in systemd.
139-
<2> Disables cgroups v1.
180+
<2> Disables cgroup v1.
140181
<3> Enables the Linux Pressure Stall Information (PSI) feature.
141182

142183
. Check the nodes to see that scheduling on the nodes is disabled. This indicates that the change is being applied:
@@ -150,7 +191,7 @@ $ oc get nodes
150191
[source,terminal]
151192
----
152193
NAME STATUS ROLES AGE VERSION
153-
ci-ln-fm1qnwt-72292-99kt6-master-0 Ready master 58m v1.25.0
194+
ci-ln-fm1qnwt-72292-99kt6-master-0 Ready,SchedulingDisabled master 58m v1.25.0
154195
ci-ln-fm1qnwt-72292-99kt6-master-1 Ready master 58m v1.25.0
155196
ci-ln-fm1qnwt-72292-99kt6-master-2 Ready master 58m v1.25.0
156197
ci-ln-fm1qnwt-72292-99kt6-worker-a-h5gt4 Ready,SchedulingDisabled worker 48m v1.25.0
@@ -172,6 +213,7 @@ $ oc debug node/<node_name>
172213
sh-4.4# chroot /host
173214
----
174215

216+
ifdef::post[]
175217
. Check that the `sys/fs/cgroup/cgroup2fs` file is present on your nodes. This file is created by cgroup v2:
176218
+
177219
[source,terminal]
@@ -184,6 +226,27 @@ $ stat -c %T -f /sys/fs/cgroup
184226
----
185227
cgroup2fs
186228
----
229+
endif::post[]
230+
ifdef::nodes[]
231+
. Check that the `sys/fs/cgroup/cgroup2fs` or `sys/fs/cgroup/tmpfs` file is present on your nodes:
232+
+
233+
[source,terminal]
234+
----
235+
$ stat -c %T -f /sys/fs/cgroup
236+
----
237+
+
238+
.Example output for cgroup v1
239+
[source,terminal]
240+
----
241+
tmp2fs
242+
----
243+
+
244+
.Example output for cgroup v2
245+
[source,terminal]
246+
----
247+
cgroup2fs
248+
----
249+
endif::nodes[]
187250

188251
ifeval::["{context}" == "nodes-cluster-cgroups-2"]
189252
:!nodes:

modules/nodes-clusters-cgroups-okd-configure.adoc

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,31 @@
33
// * nodes/clusters/nodes-cluster-cgroups-okd.adoc
44
// * post_installation_configuration/cluster-tasks.adoc
55

6+
67
ifeval::["{context}" == "nodes-cluster-cgroups-2"]
78
:node:
89
endif::[]
910
ifeval::["{context}" == "post-install-cluster-tasks"]
1011
:post:
1112
endif::[]
1213

14+
ifdef::post[]
1315
:_content-type: PROCEDURE
1416
[id="nodes-clusters-cgroups-okd-configure_{context}"]
15-
= Configuring Linux cgroup
17+
= Configuring the Linux cgroup version on your nodes
1618

17-
ifdef::post[]
18-
By default, {product-title} uses link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[Linux control group version 2] (cgroup v2) in your cluster. You can switch to link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1.html[Linux control group version 1] (cgroup v1), if needed.
19+
By default, {product-title} uses link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[Linux control group version 2] (cgroup v2) in your cluster. You can switch to link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1.html[Linux control group version 1] (cgroup v1), if needed, by using a machine config. Enabling cgroup v1 in {product-title} disables the cgroup v2 controllers and hierarchies in your cluster.
1920

2021
cgroup v2 is the next version of the kernel link:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/resource_management_guide/ch01[control group] and offers multiple improvements. However, it can have some unwanted effects on your nodes.
2122
endif::post[]
2223

23-
You can configure whether your cluster uses cgroup v1 or cgroup v2 by editing the `node.config` object. Enabling the other version of cgroup in {product-title} disables the current cgroup controllers and hierarchies in your cluster.
24+
ifdef::node[]
25+
:_content-type: PROCEDURE
26+
[id="nodes-clusters-cgroups-okd-configure_{context}"]
27+
= Configuring Linux cgroup
28+
29+
You can switch to Linux control group version 1 (cgroup v1), if needed, by using a machine config. Enabling cgroup v1 in {product-title} disables the cgroup v2 controllers and hierarchies in your cluster.
30+
endif::node[]
2431

2532
.Prerequisites
2633
* Have administrative privilege to a working {product-title} cluster.
@@ -102,9 +109,23 @@ ip-10-0-153-11.ec2.internal Ready worker 28m v1.25.0
102109
ip-10-0-153-150.ec2.internal Ready master 34m v1.25.0
103110
----
104111
+
105-
You can see that The command disables scheduling on each worker node.
112+
You can see that the command disables scheduling on each worker node.
113+
114+
. After a node returns to the `Ready` state, start a debug session for that node:
115+
+
116+
[source,terminal]
117+
----
118+
$ oc debug node/<node_name>
119+
----
120+
121+
. Set `/host` as the root directory within the debug shell:
122+
+
123+
[source,terminal]
124+
----
125+
sh-4.4# chroot /host
126+
----
106127

107-
. Check that the sys/fs/cgroup/cgroup2fs file has been moved to the `tmpfs` file system:
128+
. Check that the `sys/fs/cgroup/cgroup2fs` file has been moved to the `tmpfs` file system:
108129
+
109130
[source,terminal]
110131
----

modules/nodes-nodes-kernel-arguments.adoc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@ Examples of kernel arguments you could set include:
2222
2323
ifndef::openshift-origin[]
2424
* **systemd.unified_cgroup_hierarchy**: Enables link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[Linux control group version 2] (cgroup v2). cgroup v2 is the next version of the kernel link:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/resource_management_guide/ch01[control group] and offers multiple improvements.
25-
+
26-
--
27-
:FeatureName: {product-title} cgroups version 2 support
28-
include::snippets/technology-preview.adoc[leveloffset=+1]
29-
--
3025
endif::openshift-origin[]
26+
3127
ifdef::openshift-origin[]
3228
* **systemd.unified_cgroup_hierarchy**: Configures the version of Linux control group that is installed on your nodes: link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1.html[cgroup v1] or link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[cgroup v2]. cgroup v2 is the next version of the kernel link:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/resource_management_guide/ch01[control group] and offers multiple improvements. However, it can have some unwanted effects on your nodes.
3329
+
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
:_content-type: ASSEMBLY
22
:context: nodes-cluster-cgroups-2
33
[id="nodes-cluster-cgroups-2"]
4-
= Enabling Linux control group version 2 (cgroup v2)
4+
= Configuring the Linux cgroup version on your nodes
55
include::_attributes/common-attributes.adoc[]
66

77
toc::[]
88

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.
9+
By default, {product-title} uses link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1.html[Linux control group version 1] (cgroup v1) in your cluster. You can switch to link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[Linux control group version 2] (cgroup v2), if needed, by editing the `node.config` object. Enabling cgroup v2 in {product-title} disables all cgroup version 1 controllers and hierarchies in your cluster.
1010

1111
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.
1212

13-
:FeatureName: {product-title} cgroups version 2 support
14-
include::snippets/technology-preview.adoc[leveloffset=+0]
15-
1613
// The following include statements pull in the module files that comprise
1714
// the assembly. Include any combination of concept, procedure, or reference
1815
// modules required to cover the user story. You can also include other
@@ -21,7 +18,7 @@ include::snippets/technology-preview.adoc[leveloffset=+0]
2118

2219
include::modules/nodes-clusters-cgroups-2.adoc[leveloffset=+1]
2320

21+
[role="_additional-resources"]
2422
.Additional resources
2523

26-
* xref:../../nodes/clusters/nodes-cluster-enabling-features.adoc#nodes-cluster-enabling[Enabling OpenShift Container Platform features using FeatureGates]
2724
* xref:../../installing/index.adoc#ocp-installation-overview[OpenShift Container Platform installation overview]

nodes/clusters/nodes-cluster-cgroups-okd.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
:_content-type: ASSEMBLY
22
:context: nodes-cluster-cgroups-2
33
[id="nodes-cluster-cgroups-okd"]
4-
= Configuring the Linux cgroup on your nodes
4+
= Configuring the Linux cgroup version on your nodes
55
include::_attributes/common-attributes.adoc[]
66

77
toc::[]

post_installation_configuration/cluster-tasks.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,16 @@ include::modules/deploying-resource.adoc[leveloffset=+2]
630630

631631
ifndef::openshift-origin[]
632632
include::modules/nodes-clusters-cgroups-2.adoc[leveloffset=+1]
633+
634+
[role="_additional-resources"]
635+
.Additional resources
636+
637+
* xref:../nodes/clusters/nodes-cluster-cgroups-2.adoc#nodes-cluster-cgroups-2[Configuring the Linux cgroup version on your nodes]
633638
endif::openshift-origin[]
634639
ifdef::openshift-origin[]
635640
include::modules/nodes-clusters-cgroups-okd-configure.adoc[leveloffset=+1]
636641
endif::openshift-origin[]
642+
637643
[id="post-install-tp-tasks"]
638644
== Enabling Technology Preview features using FeatureGates
639645

0 commit comments

Comments
 (0)