K3s in Docker with systemd (cgroupfs v1) #7265
-
I am trying to run K3s 1.24 in a Docker container with systemd, but haven't had any luck. I believe this worked in earlier K3s versions until #5462, which changed the default cgroup driver from "cgroupfs" to "systemd" when systemd has been detected. My host is configured to use cgroupfs v1 (via I see that the K3s node never becomes ready:
When I describe the node, I see:
And in the K3s journald logs I see this error:
I'm not really sure what to make of this, so I tried with the "cgroupfs" cgroup driver instead. Here's my K3s config:
This time I see a "Ready" node, but Pods are stuck in ContainerCreating:
Describing the Pods shows:
I believe this is because containerd is still using the "systemd" cgroup driver:
But changing that value to "false" and deleting Pods didn't seem to change the behavior I'm seeing 🤔 Has anyone had luck getting K3s to run in Docker with systemd? If so, could you please share your configuration? I'm trying to integrate with a Docker-based test framework and would really like to see this working! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Beta Was this translation helpful? Give feedback.
-
That's correct. The full background is that I have Puppet managing the installation and configuration of K3s along with other node configurations and am using the Puppetlabs Litmus test framework with the Docker provisioner for acceptance testing. It's not perfect, but good enough in most cases. I was looking to do some simple assertions, like validating I just found that I can template the containerd config with Hmm... now that I think about it though... if that approach is reasonable, maybe the cgroupfs driver shouldn't default to "systemd" when Docker + systemd is detected? 🤔🤷♂️ |
Beta Was this translation helpful? Give feedback.
-
Ah, yes, I was overriding the kubelet's cgroup driver via kubelet args. I had initially tried without overriding the cgroup driver (which detected "systemd") but was met with Is there a way to specify "cgroupfs" or "systemd" without kubelet args? Or a better way to approach this with the "systemd" cgroup driver? |
Beta Was this translation helpful? Give feedback.
This is a bit of a hack, but can you try doing
echo INVOCATION_ID= >> /etc/default/k3s.env
? That will fake k3s into thinking it's on an old version of systemd that cannot be used as the cgroup driver.