| 1 | # kind specific additions go in this file |
| 2 | [Service] |
| 3 | # On cgroup v1, the /kubelet cgroup is created in the entrypoint script before running systemd. |
| 4 | # On cgroup v2, the /kubelet cgroup is created here. (See the comments in the entrypoint script for the reason.) |
| 5 | ExecStartPre=/bin/sh -euc "if [ -f /sys/fs/cgroup/cgroup.controllers ]; then /kind/bin/create-kubelet-cgroup-v2.sh; fi" |
| 6 | # on WSL2 (and potentially other distros without systemd) /sys/fs/cgroup/systemd is created after the entrypoint, during /sbin/init. |
| 7 | # This eventually leads to kubelet failing to start, see: https://github.com/kubernetes-sigs/kind/issues/2323 |
| 8 | ExecStartPre=/bin/sh -euc "if [ ! -f /sys/fs/cgroup/cgroup.controllers ] && [ ! -d /sys/fs/cgroup/systemd/kubelet ]; then mkdir -p /sys/fs/cgroup/systemd/kubelet; fi" |