Skip to content

Commit 1704c72

Browse files
dlipovetskyfaiq
andauthoredOct 6, 2022
fix: Configure containerd runc plugin options with systemd cgroup driver (#493)
* fix: Configure containerd runc plugin to use systemd cgroup driver konvoy-image-builder installs kubelet as a systemd service, and kubelet therefore uses the systemd cgroup driver. The container runtime must use the same cgroup driver. > Note: In v1.22, if the user is not setting the cgroupDriver field > under KubeletConfiguration, kubeadm will default it to systemd. > -- https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/ * Use runtime type 'io.containerd.runc.v2' The 'io.containerd.runc.v1' runtime type was deprecated in containerd 1.4, and does not support the systemd cgroup driver. * Use systemd cgroup driver with the nvidia runtime The option should work, because the nvidia runtime is just a repackaged runc runtime. * Use SystemdCgroup instead of systemd_cgroup Using snake case has no effect. Confirmed independently by both @faiq and @dlipovetsky. * Use "io.containerd.runc.v2" for nvidia container runtime Only "io.containerd.runc.v2" supports the SystemdCgroup option we need. I have seen multiple examples of this configuration in the wild, and since nvidia-container-runtime is a wrapper around runc, there should be no issues with using v2 of the containerd wrapper to runc. * fix: from poor merge * fix: allows cgroups v2 by default for flatcar Co-authored-by: Faiq <faiq@users.noreply.github.com> Co-authored-by: faiq <faiqrazarizvi@gmail.com>
1 parent 828b6e0 commit 1704c72

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed
 

‎ansible/roles/config/templates/config.toml.tmpl

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ imports = ["/etc/containerd/conf.d/*.toml"]
6464
enable_selinux = false
6565
sandbox_image = "{{ pause_image }}"
6666
stats_collect_period = 10
67-
systemd_cgroup = false
6867
enable_tls_streaming = false
6968
max_container_log_line_size = 16384
7069
disable_cgroup = false
@@ -88,10 +87,12 @@ imports = ["/etc/containerd/conf.d/*.toml"]
8887
privileged_without_host_devices = false
8988
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
9089
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
91-
runtime_type = "io.containerd.runc.v1"
90+
runtime_type = "io.containerd.runc.v2"
9291
runtime_engine = ""
9392
runtime_root = ""
9493
privileged_without_host_devices = false
94+
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
95+
SystemdCgroup = true
9596
[plugins."io.containerd.grpc.v1.cri".cni]
9697
bin_dir = "/opt/cni/bin"
9798
conf_dir = "/etc/cni/net.d"

‎ansible/roles/containerd/tasks/install-flatcar.yaml

-13
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,3 @@
2828
copy:
2929
content: "export PATH=$PATH:/run/torcx/unpack/docker/bin/"
3030
dest: "/etc/profile.d/my_path.sh"
31-
32-
- name: ensure cgroups v2 are disabled
33-
command: grep -q systemd.unified_cgroup_hierarchy=0 /usr/share/oem/grub.cfg
34-
changed_when: no
35-
failed_when: false
36-
register: cgroupsv2_check
37-
38-
- name: cgroups setup
39-
when:
40-
- cgroupsv2_check.rc != 0
41-
block:
42-
- name: disable cgroups v2
43-
command: sed -E -i 's/^(set linux_append=.*)"$/\1 systemd.unified_cgroup_hierarchy=0 systemd.legacy_systemd_cgroup_controller"/g' /usr/share/oem/grub.cfg

0 commit comments

Comments
 (0)