Home > Back-end >  Can I use systemd as the cgroup driver of kubernetes on a linux machine using cgroup v1?
Can I use systemd as the cgroup driver of kubernetes on a linux machine using cgroup v1?

Time:01-05

I am wondering if systemd could be used as the cgroup driver in cgroup v1 environment.

NOTE: As mentioned in Kubernetes Container Runtimes Doc, cgroupfs is preferred when the OS have cgroup v1.

I have tried to set up a Kubernetes cluster using systemd as cgroup driver, and it is working correctly for now.

The test env is:

  • Kubelet: 1.23
  • OS: Ubuntu 20.04 (Kernel 5.4.0, cgroup v1)
  • CRI: containerd 1.5.9
  • Cgroup Driver: systemd

Are there any risks by using systemd in cgroup v1 env?

CodePudding user response:

NOTE: As mentioned in Kubernetes Container Runtimes Doc, cgroupfs is preferred when the OS have cgroup v1.

Can you specify which paragraph is this? If not mistaken the document didn't state cgroupfs is preferred over systemd for distro that uses cgroup v1. systemd is widely accepted as the init system but cgroup v2 is available only if you run a fairly new (>=5.8) kernel.

Are there any risks by using systemd in cgroup v1 env?

Cgroup v1 is mostly in-use to date and systemd is designed to work with it. That being said, cgroupfs is the default for kubelet at this time of writing. As kernel mature overtime, systemd may one day become the default and all the backing CRI will follow thru.

A side note, docker default to cgroupfs on system that only support cgroup v1 (regardless if systemd is present). It will use systemd on system that uses cgroup v2 and systemd is present. However, k8s has dropped docker as the CRI with the removal of dockershim starting v1.24. You can continue with dockershim with Mirantis.

  • Related