Question about cgroups v2

Kubernetes v1.19 will become GA soon with support of cgroups v2. Now FCOS disabled cgroups v2 with cmdline but will you make cgroups v2 default immediately after kubernetes v1.19 release? (Or make this an ignition option?)

There is currently a discussion about this topic in the fedora-coreos-tracker. I think the current plan is to make it easy to set cgroups v2 via Ignition.

1 Like

If you can’t wait for this change to hit in FCOS you can enable cgroups v2 (not hybrid cgroups v1/v2) with this ignition block:

systemd:
  units:
  - name: enable-cgroups-v2.service
    enabled: true
    contents: |
      [Unit]
      Description=Enable cgroups v2 (systemd.unified_cgroup_hierarchy)
      ConditionFirstBoot=true
      After=ignition-complete.target
      Before=default.target

      [Service]
      Type=oneshot
      ExecStart=/usr/bin/rpm-ostree kargs --replace systemd.unified_cgroup_hierarchy=1 --reboot

      [Install]
      WantedBy=basic.target

Note: Once this unit starts it will reboot your node ASAP on the first boot.

2 Likes

We’ve recently updated this example in the documentation to better take into account corner cases:

systemd:
  units:
    - name: cgroups-v2-karg.service
      enabled: true
      contents: |
        [Unit]
        Description=Switch To cgroups v2
        # We run after `systemd-machine-id-commit.service` to ensure that
        # `ConditionFirstBoot=true` services won't rerun on the next boot.
        After=systemd-machine-id-commit.service
        ConditionKernelCommandLine=systemd.unified_cgroup_hierarchy
        ConditionPathExists=!/var/lib/cgroups-v2-karg.stamp

        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStart=/bin/rpm-ostree kargs --delete=systemd.unified_cgroup_hierarchy
        ExecStart=/bin/touch /var/lib/cgroups-v2-karg.stamp
        ExecStart=/bin/systemctl --no-block reboot

        [Install]
        WantedBy=multi-user.target
2 Likes