Skip to content

fix(bootstrap): support cgroup v1 hosts by disabling kubelet failCgroupV1 check#360

Merged
drew merged 1 commit intomainfrom
fix-cgroupv1-kubelet-compat/dn
Mar 16, 2026
Merged

fix(bootstrap): support cgroup v1 hosts by disabling kubelet failCgroupV1 check#360
drew merged 1 commit intomainfrom
fix-cgroupv1-kubelet-compat/dn

Conversation

@drew
Copy link
Collaborator

@drew drew commented Mar 16, 2026

Summary

Fix gateway startup failure on Linux hosts that use cgroup v1 (e.g. Rocky Linux 8, CentOS 7/8, Ubuntu 18.04). Kubernetes 1.35 (bundled in k3s v1.35.2) rejects cgroup v1 by default, causing kubelet to exit immediately with kubelet is configured to not run on a host using cgroup v1.

Related Issue

Reported by a user running Rocky Linux 8 with Docker 29.3.0. The prior fix in #329 (commit a458ca6) addressed a different cgroup issue (private cgroupns on Docker Desktop preventing access to cgroup v2 controllers) and did not resolve the cgroup v1 rejection.

Changes

  • Detect cgroup v1 at container startup by checking for the absence of /sys/fs/cgroup/cgroup.controllers (which only exists on cgroup v2 unified hierarchy)
  • When cgroup v1 is detected, pass --kubelet-arg=fail-cgroupv1=false to k3s so kubelet logs a deprecation warning instead of refusing to start
  • The detection is reliable because the container runs with cgroupns_mode: host, so /sys/fs/cgroup reflects the host's cgroup filesystem

Testing

  • mise run pre-commit passes
  • Manual testing on a cgroup v1 host (Rocky Linux 8) needed
  • Unit tests added/updated — N/A (shell script change, no testable Rust code)
  • E2E tests added/updated — N/A

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable) — N/A

…upV1 check

Kubernetes 1.35 (k3s v1.35.x) rejects cgroup v1 by default via the
failCgroupV1 kubelet config option. This breaks gateway startup on
distros that still use cgroup v1 (e.g. Rocky Linux 8, CentOS 7/8).

Detect cgroup v1 at container startup by checking for the absence of
/sys/fs/cgroup/cgroup.controllers and pass
--kubelet-arg=fail-cgroupv1=false so kubelet warns instead of exiting.
@drew drew self-assigned this Mar 16, 2026
@drew drew requested review from johntmyers and pimlock March 16, 2026 17:31
@drew drew merged commit bee0ea8 into main Mar 16, 2026
9 checks passed
@drew drew deleted the fix-cgroupv1-kubelet-compat/dn branch March 16, 2026 17:36
# so kubelet warns instead of refusing to start. This flag can be removed once
# cgroup v1 support is no longer needed.
EXTRA_KUBELET_ARGS=""
if [ ! -f /sys/fs/cgroup/cgroup.controllers ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI in docs this is how they document checking the version:

stat -fc %T /sys/fs/cgroup/
For cgroup v2, the output is cgroup2fs.
For cgroup v1, the output is tmpfs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants