Kubernetes normally runs the kubelet and other node components with root privileges on the host. Kubernetes 1.37 changes the security story by moving KubeletInUserNamespace, also known as rootless mode, to Beta.
Rootless mode allows the kubelet, container runtime, CNI plugins, and kube-proxy to run as a non-root host user inside a Linux user namespace. Inside that namespace, the process can have namespace-local root privileges, while the host still sees it as an unprivileged user.
This is useful when you want to reduce the damage a compromised node component could cause to the host. It is also useful for development machines, shared systems, AI sandboxes, and Kubernetes-in-Kubernetes environments.
What Does Rootless Kubelet Actually Mean?
There are two different concepts that are easy to confuse.
A pod can run as a non-root user by using its security context. That changes the identity of processes inside the pod.
Rootless Kubernetes is different. The node components themselves run inside a Linux user namespace.
The basic model looks like this:
Host
|
|-- Normal user: UID 1000
|
`-- Linux user namespace
|
|-- kubelet
|-- container runtime
|-- CNI
|-- kube-proxy
|
`-- Pods
Inside the user namespace, UID 0 can be used for operations that are allowed by the namespace. Outside the namespace, those operations do not give the process real root privileges on the host.
This distinction matters because rootless mode is an isolation mechanism, not simply a way to change the User= setting in a systemd service.
What Changed in Kubernetes 1.37?
The KubeletInUserNamespace feature graduated to Beta in Kubernetes 1.37.
The feature gate is enabled by default in this release. That does not mean existing Kubernetes nodes automatically become rootless.
The feature allows the kubelet to operate correctly when it is already running inside a user namespace. You still need to create the user namespace and configure the surrounding runtime and host environment.
Kubernetes 1.37 also exposes whether a node is running in a user namespace through the node status. This can help cluster administrators identify rootless nodes and keep workloads that require real host-level privileges away from them.
How Linux User Namespaces Provide the Isolation
A Linux user namespace creates a separate mapping between user IDs inside and outside the namespace.
For example, a host user might be UID 1000:
Host UID 1000
|
v
User Namespace UID 0
The process can therefore appear as root inside the namespace without becoming root on the host.
The same concept applies to other namespaces and kernel resources needed by Kubernetes.
This is why rootless Kubernetes needs more than a different Unix account. The environment has to provide the namespace, writable filesystem locations, cgroup support, networking support, and other resources expected by the node components.
Requirements for a Rootless Kubernetes Node
Before testing rootless kubelet, check the host configuration.
1. Linux User Namespaces
The environment must support Linux user namespaces.
The user running Kubernetes also needs subordinate UID and GID ranges. These are normally configured through /etc/subuid and /etc/subgid.
For example:
developer:100000:65536
This gives the user a range of IDs that can be mapped into the namespace.
The exact values depend on the host and distribution.
2. Cgroups v2
Rootless Kubernetes works with cgroups v2.
Check the current cgroup filesystem:
stat -fc %T /sys/fs/cgroup
A cgroups v2 system normally reports:
cgroup2fs
Kubernetes 1.37 also continues its move away from cgroups v1, so using cgroups v2 is the better starting point for a new rootless environment.
3. systemd User Sessions
A rootless environment may need systemd user-session support, especially when cgroups and services are managed through systemd.
Make sure the unprivileged account can maintain its user session independently of an interactive login.
4. Writable Kubernetes Directories
The node components need writable paths inside the user namespace.
Typical paths include:
/etc
/run
/var/log
/var/lib/kubelet
/var/lib/cni
/var/lib/containerd
The exact paths depend on the runtime and how the distribution is assembled.
The important point is that these paths must be writable inside the namespace without giving the host user unrestricted root access.
The Simplest Way to Test Rootless Kubernetes
For most developers, manually building a rootless node is not the best first test.
A local Kubernetes tool such as kind or minikube can run Kubernetes inside a rootless container runtime.
For example, after configuring Rootless Docker, a kind cluster can be created normally:
dockerd-rootless-setuptool.sh install
kind create cluster
The important part is that the container runtime itself is running rootless. Kubernetes then runs inside that user-controlled environment.
Minikube provides a similar approach when used with a rootless Docker or Podman environment.
This setup is much easier to test than manually creating every namespace and mount.
Manually Running the Kubelet in a User Namespace
Manual deployment is primarily useful for Kubernetes distribution developers and people working on node-level infrastructure.
The first step is to create a Linux user namespace.
For example:
unshare --user --map-root-user --mount
This creates a user namespace where the current user can appear as root inside the namespace.
A real Kubernetes setup requires more than this command. Additional namespaces, mounts, networking, cgroups, container runtime configuration, and filesystem permissions must be prepared.
The kubelet also needs access to the expected configuration and state directories.
A simplified layout might look like:
User Namespace
|
|-- /etc
|-- /run
|-- /var/log
|-- /var/lib/kubelet
|-- /var/lib/cni
`-- /var/lib/containerd
These paths should be writable from inside the namespace without modifying host resources outside the intended boundary.
Why the Kubelet Needs Special Handling
The kubelet normally expects to interact with parts of the Linux system that are traditionally controlled by root.
Examples include:
Kernel sysctl values
/dev/kmsgcgroups
Mount operations
Network namespaces
Container runtime state
Pod filesystem mounts
Rootless mode does not magically give the process unrestricted access to all of these resources.
Instead, the user namespace provides a restricted environment where some operations can succeed with namespace-local privileges.
Kubernetes 1.37 specifically improves kubelet behavior around operations that are expected to fail when running rootless, including certain sysctl changes and access to kernel messages.
Container Runtime Compatibility Matters
The kubelet is only one part of a Kubernetes node.
A rootless configuration also involves the container runtime.
The overall path is roughly:
kubelet
|
v
CRI
|
v
container runtime
|
v
OCI runtime
|
v
Linux namespaces and cgroups
Join the conversation! Your thoughts help the community grow.