|
| 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