Kubernetes user namespaces: what hostUsers false changes for pod isolation
By default, many containers run as root inside the pod. Root in the container maps to root on the node, so if an attacker escapes the container through a runtime or kernel flaw, they may land with root-level access on the host. User namespaces narrow that gap by mapping the container's root user to an unprivileged user ID on the host. Kubernetes user namespaces for pods have been stable since Kubernetes v1.36. A pod opts in by setting pod.spec.hostUsers to false, and the kubelet and container runtime create the mapping for that pod. Teams should read the Kubernetes user namespaces documentation before changing any workload.
Consider this feature when your platform runs multi-tenant or untrusted workloads, when pods that currently need root inside the container can be made to run without it, or when a compliance review asks how container escape risk is reduced. It is a containment control, not a substitute for dropping capabilities, enforcing Pod Security Standards or restricting privileged pods. Those controls prevent many escapes in the first place, so they should usually be in place before you rely on user namespaces as an additional layer.
Before enabling it, confirm with your distribution vendor and your kernel and container runtime documentation that the nodes meet the stated requirements, and test on a non-production node pool first. Ask whether your storage drivers, CNI and monitoring agents work with mapped IDs, and identify which workloads write to host paths or depend on specific UIDs. Those checks determine whether the change is a small configuration step or a project of its own.
Which pods to run with hostUsers false and which to leave alone
This table compares common pod types against user namespace opt-in, stating when each option fits and what to verify first. Read each row as a decision: the pod type on the left determines whether hostUsers false is a good candidate, a poor fit or something to test before rollout. The main takeaway is that the pods that gain most are root-running workloads without host access, and the pods that lose most are those tied to host namespaces or host-owned volumes.
| Workload type | Fit with hostUsers false | What the team must verify first |
|---|---|---|
| Root container, no host namespaces | Strong candidate | Confirm the image runs as UID 0 only for setup, and that file ownership inside the container matches the mapped user range |
| Non-root container, no host namespaces | Candidate after testing | Confirm the runtime, kernel and node meet the stated requirements, then test file writes to volumes with the pod's ids |
| Host networking (hostNetwork true) | Poor fit, leave alone | Host network sharing is outside the isolation user namespaces provide, so review whether the pod needs it at all |
| Host PID or host IPC | Poor fit, leave alone | Confirm whether the workload reads host processes or shared memory, and keep it in a namespace without user remapping until redesigned |
| Privileged pods | Do not rely on it | Privileged settings change what the container can do on the node, so isolation gains are limited; confirm whether privileges can be removed first |
| Volumes whose ownership cannot be remapped | Test before adopting | Check hostPath, NFS and CSI volumes for ownership and permission behavior with the mapped ids before any production change |
| Node-level agents (log shippers, CNI, storage daemons) | Usually leave alone | These often need host paths and host access; confirm vendor guidance and test on a non-production node pool |
How container root maps to an unprivileged host user
The diagram starts at the kubelet, which asks the container runtime to create a pod. When hostUsers is set to false, the runtime creates a separate user namespace for the pod, so UID 0 inside the container maps to an unprivileged UID on the node. A pod without the setting shares the host user namespace, so its root process is host root. The boundary to check is the one a container escape must cross: the kernel's user namespace layer. Confirm that your node kernel and runtime support the feature before relying on it.
Pod user namespace separates container root from host root on the node.
Setup: node, kernel and runtime checks before enabling hostUsers false
This sequence confirms that the cluster, each node's runtime and kernel, and the workloads themselves can support user namespaces before any production pod opts in. Each step ends with a check that shows whether it is safe to move on.
Confirm the cluster runs v1.36 or newer
The platform team checks the server version of the kube-apiserver and the kubelet on every node, because user namespaces for pods are stable from Kubernetes v1.36 and a pod opts in by setting pod.spec.hostUsers to false. Run the version query against the API server and record the kubelet version reported for each node. This step is complete when every node reports v1.36 or newer. If any node is older, stop here and plan the upgrade first, following the version skew rules for the control plane and kubelets.
Verify runtime and kernel support on each node
The platform team confirms, using the distribution's own documentation, that the container runtime and the Linux kernel on each node support user namespaces for pods. Ask the distribution vendor or your build team which runtime versions and kernel settings they validate, and check the node image for the expected kernel configuration. This step is complete when you have a written list, per node pool, that names the runtime version and kernel version and cites the distribution statement that covers them. Do not assume a node pool supports the feature because another pool does.
Pick a node pool and a test namespace
The platform team selects one node pool that passed the previous check, along with a non-production namespace that has no shared storage and no privileged workloads. Taint or label the pool so the test pod lands only on nodes you verified. This step is complete when a test pod spec can be scheduled to that pool and the namespace is confirmed empty of production traffic. Keep the test scope small so any failure stays contained.
Run a single test pod with hostUsers false
The platform team deploys one non-production pod with pod.spec.hostUsers set to false, using the same base image and security context the real workload will use. Watch the pod events and status until it reaches Running, and confirm the container process runs as the expected non-root user inside the pod. This step is complete when the pod starts, stays Running through its readiness checks, and its logs show the application initializing normally. If the pod fails to start, capture the events and runtime errors before changing anything else.
Check file ownership on mounted volumes
The platform team exec into the test pod and inspect the ownership and permissions of every mounted path, including ConfigMaps, Secrets, emptyDir volumes and persistent volumes. Compare the UID and GID the process sees with the ownership on the host side for the volumes the workload writes to. This step is complete when the application can read its configuration and write to its data paths without permission errors, and any volume that needs a different owner has been identified and documented. Volumes that fail here are the most common reason a workload breaks, so record each one.
Confirm the workload behaves as before
The application owner runs the workload's normal functional tests against the test pod, including any operations that write files, open sockets or call privileged system APIs. Compare results with the same workload running without hostUsers false. This step is complete when the tests pass with no new failures and the owner signs off on the behavior in writing. Record any tool or workload that needs a change, such as a different securityContext or a ownership fix, before it goes into a wider rollout.
Roll out to one namespace at a time
The platform team adds hostUsers false to the pod templates for one production namespace, usually through the same change process used for other workload changes, and rolls it out while watching pod status, restarts and application error rates. Move to the next namespace only after the previous one has run through its normal operating cycle without new failures. This step is complete when each namespace shows healthy rollouts and the change record names the node pool, the runtime and kernel versions and the owner who approved each namespace.
How user namespaces limit the impact of a container escape
With user namespaces enabled, a process that runs as UID 0 inside the container is mapped to an unprivileged UID on the node. If an attacker exploits a flaw in the runtime or kernel and breaks out of the container, the process still holds an unprivileged identity on the host. That means it cannot freely write to root-owned files under paths such as /etc or /var/lib/kubelet, cannot read other pods' root-owned volumes, and cannot change ownership of host files it reaches. The breakout lands as a normal host user, not as root. The reduction is largest for attacks that rely on root-level file access on the host after the escape, and smaller for kernel exploits that do not depend on file permissions.
Treat this as one layer that narrows impact, not as protection against escapes. Container escapes can still happen, and user namespaces do not stop kernel vulnerabilities from being exploited. Before you rely on the control, confirm the node kernel, container runtime and kubelet versions support user namespaces for your chosen Kubernetes release, and test the setting on a non-production node pool. Check the setting against the Kubernetes user namespaces documentation for the release you run, since requirements can differ between versions.
The other controls still matter, and they carry more weight than this one. Keep nodes and the kernel patched, since a patched kernel removes the flaws most escapes rely on. Keep seccomp profiles applied, enforce Pod Security Standards at the Baseline or Restricted level in each namespace, and limit RBAC so that a compromised pod service account cannot create privileged pods or read Secrets across namespaces. A useful planning question is which pods would still have host-level reach after a breakout under your current configuration, and whether user namespaces change that answer for them.
Which workloads break under user namespaces and what to test first
User namespaces change how root inside a container maps to the host, so workloads that depend on real host root, host paths or fixed numeric ownership are the ones that fail first. The cards below cover the patterns most likely to need changes, what to test for each, and who usually owns the fix.
Pods that bind-mount host paths
Pods that mount directories such as /var/log, /var/lib/kubelet or device paths from the node depend on host file ownership and permissions. With user namespaces, the container's UID and GID map to unprivileged host IDs, so writes to host-owned paths can fail with permission errors even when the pod runs as root. Test every hostPath volume and confirm the ownership the workload expects on the node. The platform team usually owns the decision to keep a hostPath, and the application owner owns any change to file paths.
Pods writing to shared volumes with fixed UIDs
Workloads that write to a shared volume using a fixed numeric UID, such as a backup job or a log writer, may find that the UID inside the pod maps to a different host UID than the one that owns the volume. Two pods that agree on a UID inside their namespaces may no longer agree on ownership on disk. Test read and write access from every pod that shares the volume, including init containers and sidecars. The application team usually owns the UID choice, and the storage team owns the volume ownership settings.
Pods using host networking or host PID
Pods with hostNetwork: true or hostPID: true share the node's network or process namespace, and user namespaces do not isolate those shared namespaces. Teams sometimes assume that enabling hostUsers: false protects these pods, but the isolation gained is limited. Confirm which pods use host namespaces and whether they need them at all. The platform team owns the review, and the team that deploys each agent or monitoring tool owns the justification.
CSI node plugins and privileged system agents
CSI node plugins, device plugins and node agents usually run privileged and write to kubelet directories, device nodes and mount points on the host. These components are generally excluded from user namespaces because they must act on host resources directly. Check the vendor's documentation for whether the driver supports running inside a user namespace before changing anything. The storage or platform team owns the driver configuration, and the vendor's support terms define what is supported.
Images that assume root can change ownership
Many container images run chown or chmod during startup, install packages into root-owned paths, or write to directories that only root can modify. Inside a user namespace, these operations succeed only for IDs mapped to the pod's own range, so ownership changes on volumes or image layers can fail. Run the image's startup path in a test pod with hostUsers: false and read the logs for permission errors. The application owner usually owns the image fix, and the platform team owns the test pipeline that catches it.
Workloads that need a checklist before rollout
Use one test pass for each workload class before enabling hostUsers: false in production, and record the result. Include a run of the pod's normal startup, a read and write check on each mounted volume, a check of any service that depends on host IDs, and a rollback step that removes the field. Confirm your node runtime and kernel meet the requirements in the Kubernetes docs before the test starts. The platform team owns the checklist, and each workload owner signs off on their own results.
Rollout approach by cluster version and workload type
On clusters running v1.36 or newer, user namespaces for pods are stable, so the main work is deciding where the setting goes rather than confirming the feature exists. Begin with a namespace that holds new, self-contained workloads, and set hostUsers: false in the pod spec of a pilot Deployment. Leave the rest of the namespace unchanged so that any failure stays small and easy to roll back. For the feature's details, see the Kubernetes user namespaces documentation.
Decisions for the platform team:
- Pilot namespace: choose one namespace whose workloads your team owns end to end and can restart without coordinating with other groups.
- Opt-in method: decide whether each pod sets
hostUsersitself or whether a policy sets it across a namespace. Check how your admission tooling handles the field before relying on either method. - Node readiness: confirm with your distribution that each node pool's kernel and container runtime support the mapping before pods with the setting are scheduled there.
- Volume ownership: test reads and writes on every mounted volume, because host-side UID mapping changes what the container user can access.
Before expanding past the pilot, check that the pilot pods start on every node pool and that file ownership on volumes matches what the application expects.
On clusters older than v1.36, do not assume the feature is stable in your build. Upstream stability dates do not automatically apply to distribution builds, so the first step is written confirmation from your distribution vendor or its documentation for each cluster. The version skew policy also matters here, because kubelets may be up to three minor versions older than kube-apiserver, and node pools often lag the control plane. Work through the steps in order: inventory, confirm, test, then decide whether to upgrade.
Decisions for the platform team:
- Version inventory: record the minor version of the control plane and of every node pool, including nodes that were not upgraded with the rest of the cluster.
- Distribution confirmation: ask whether the feature is available, whether it is enabled by default, and whether it is still marked experimental in your build.
- Runtime and kernel check: verify with the vendor that the container runtime and host kernel in your node images support the mapping, since node images often lag the control plane.
- Upgrade or exception: if support is not confirmed, weigh a minor-version upgrade, which must proceed one minor version at a time, against running without this control.
- Documented gap: if the cluster stays on its current version, record the isolation gap and the compensating controls for your auditors.
Before any opt-in manifest reaches production, keep the vendor's written confirmation for that specific cluster version on file.
Databases, message brokers, network plugins, storage drivers and node agents often depend on specific file ownership, host paths or host namespaces. Changing how container root maps to the host can affect them in ways that appear only after a restart or a restore, so these workloads should follow a slower path than stateless applications. Classify workloads first, then test each class in a staging environment that matches production volumes and node pools.
Decisions for the platform team:
- Workload classification: separate stateful applications, node agents, CNI and CSI components, and any pod that uses host networking, host PID or host paths.
- Restore rehearsal: restore a recent backup into a test volume under the new configuration and confirm the application starts with its data readable and writable.
- Vendor support statements: ask each operator, chart or plugin vendor whether its workload supports user namespaces before enabling the setting.
- System component sequencing: keep kube-system and storage components out of the first wave unless each vendor confirms support in writing.
Before the change window, confirm that every stateful workload has passed a restore test and that its vendor's support statement is on file.
Security and operations considerations once user namespaces are on
Turning on user namespaces changes how pods interact with admission, logging, incident response, upgrades and audit evidence. The cards below cover the checks that connect those areas so the setting stays in force and can be shown to a reviewer.
Pod Security Admission and Restricted policies
Pod Security Admission enforces the Privileged, Baseline and Restricted standards per namespace, and the setting is one field in the pod spec that teams must be able to set without weakening those standards. Confirm which namespaces enforce Restricted, then test that pods setting hostUsers to false are admitted there and that no namespace label or exemption lets a pod run with host user mapping disabled. Record the expected result for each namespace in your change record.
Pod Security StandardsAudit logs and monitoring for the new pod field
Audit logs record who created or changed workloads, but you need to decide whether pod specs with hostUsers set are visible in your log pipeline and alerts. Define a query that flags pods running without user namespaces in sensitive namespaces, and a second query for pods that set the field to true or leave it unset in those same namespaces. Confirm with your platform team how long these events are retained and where they are forwarded.
Image and volume ownership during incident response
Remapped pods use host UIDs and GIDs that differ from the ones inside the container, so files on hostPath or shared volumes can show ownership that looks unfamiliar during an investigation. Document the mapping for each workload, including which host range applies, and agree how responders will translate container UIDs when they inspect files on a node. Without that step, responders may misread ownership as tampering or miss a real change.
CIS Kubernetes Benchmark mapping
The CIS Kubernetes Benchmark is a consensus configuration guide for upstream Kubernetes and several managed services. Map the controls it covers for pod security, such as restrictions on privileged containers and host namespaces, to the policies and namespace labels you enforce, and note where user namespaces provide an additional layer. Ask your assessor which benchmark version and control IDs they will use, because the mapping must match the version you cite.
CIS Kubernetes BenchmarkKeeping the setting through upgrades
User namespaces became stable in Kubernetes v1.36, so clusters on earlier versions may run the feature under different conditions than your target version. Before each minor upgrade, check the release notes, confirm the runtime and kernel still support the feature on every node pool, and re-run a test pod with hostUsers set to false. Plan upgrades so that kube-apiserver moves one minor version at a time, and confirm kubelets stay within the supported skew before the setting is used on new nodes.
Version skew policyDocumenting the control for a compliance reviewer
A reviewer will want a written statement of the control, the scope it covers, the namespaces and workloads it applies to, and the evidence that it works. Prepare a short control record that names the Kubernetes version, the nodes and runtime that support it, the admission policy that enforces it, the test results and the exceptions with owners and review dates. Keep the record current as upgrades and new workloads change the picture. Auditors and certification bodies make the assessment; your record supplies what they test.
Limits to confirm in your environment before rollout
Before you enable hostUsers: false on any node pool, answer four questions with your distribution, container runtime and kernel vendors. First, which runtime and kernel combination on each node pool supports user namespaces for pods, and does your vendor support that exact combination? Support differs between Kubernetes distributions, so confirm it per pool rather than assuming one cluster-wide answer. Second, does the feature work with every CSI driver you run? Storage drivers that set ownership or permissions on volumes need to be tested with mapped UIDs and GIDs, because a volume written by one user identity may not be accessible to the pod's mapped identity. Ask each storage vendor whether its driver has been tested with user namespaces, and run a write-and-read test on a representative volume.
Third, identify every admission policy, validating or mutating webhook, and mutating controller that touches pod specs. Some tools inject fields, add security contexts or reorder settings, and a mutation that conflicts with hostUsers can cause pods to be rejected or quietly change behavior. Pod Security Admission, policy engines and your own admission controllers should all be reviewed against a pod that sets hostUsers to false. Fourth, ask how the setting behaves across the upgrade path. Confirm whether the feature's status, defaults and required kernel or runtime versions change in each minor release you plan to cross, and whether a node that is upgraded before its runtime or kernel can run pods that opt in. Record these answers in writing with the vendor, and retest after each upgrade step.
What teams ask before enabling user namespaces for pods
What does it cost to enable user namespaces for pods?
Cost comes mostly from people time, not licenses, because user namespaces are a Kubernetes feature with no separate product fee. The main drivers are the number of node pools that need a kernel and runtime check, how many workloads you need to test for file ownership and privilege problems, and whether you need to upgrade nodes first. Costs split into one-time work (node validation, a pilot, documentation) and recurring work (testing new images and reviewing exceptions after each cluster upgrade). Ask any partner for a written scope that lists the node pools, workloads and environments in scope, the verification steps and who signs off. No external figure for this work was supplied, so compare quotes against that scope.
How long does a user namespaces rollout take?
The duration depends on your cluster version, node readiness and the number of workloads that must be tested, not on the feature itself. A small cluster with a few well-understood services usually moves faster than a multi-tenant platform with many inherited images. Plan the rollout in stages: confirm the cluster runs a release where the feature is stable, validate one node pool, pilot a limited set of namespaces, then expand. Each stage can stall on image ownership issues or on kernel and runtime checks, so leave room for remediation. Ask for milestones and exit criteria rather than a single end date.
What must our internal team provide before the work starts?
Your team should provide access to the cluster and nodes, a list of workloads and their images, and the current Pod Security Standards and admission setup. You also need someone who can confirm node operating system, kernel and container runtime versions, and who owns each application so behavior changes can be decided. Provide a staging environment that mirrors production node pools, along with change windows and a rollback path. Without these inputs, the first weeks of any engagement go to discovery rather than configuration.
Can our platform team enable user namespaces without a partner?
Yes, a platform team with Kubernetes and Linux experience can do this in-house, provided it has time to test the workloads and capacity to own the exceptions. The work is well bounded: verify node and runtime support, set hostUsers to false on a pilot workload, and then widen it. Teams often underestimate the application side, where images that expect root-owned files or host access need changes. A partner adds the most value when your team lacks spare capacity, needs an independent review, or must produce evidence for an assessment.
Does enabling user namespaces stop container escapes?
No. User namespaces reduce the impact of some container escapes by mapping root inside the container to an unprivileged user on the host, so a compromised process has fewer host privileges. They do not block every escape path, and they do not replace Pod Security Standards, least-privilege RBAC, network policies, runtime detection or patching. Treat the setting as one layer in a defense-in-depth design, and confirm with your security team which attack paths remain open for your workloads. A security test can show how much a specific setup reduces risk in practice.
Which workloads usually break when pods use user namespaces?
Workloads that depend on real host root or on host-level resources are the most likely to fail. Common examples include pods that write to host paths, need privileged networking or device access, or assume ownership of files on shared volumes. Storage drivers, CNI components and some monitoring agents often need careful review. Build an inventory of pods with host namespaces, privileged settings or hostPath volumes, then test each group separately. Ask any partner to show the test plan for those categories before work begins.
What should we check on nodes before turning it on?
Check that every node in the target pool runs a Kubernetes release where user namespaces for pods are stable, that the kernel and container runtime support the feature, and that your node image is consistent across the pool. Confirm the setting behaves the same on each node type, since mixed node pools can produce different results. Document the versions you verified so the configuration can be reproduced after upgrades. The feature is stable from Kubernetes v1.36, so clusters on earlier releases need a different plan, and any version decisions should follow your upgrade schedule.
How DeployOpen scopes and delivers user namespace rollouts
DeployOpen plans, builds and documents user namespace support for Kubernetes pods in clusters you control, starting with an inventory of which workloads can run with hostUsers set to false. The work follows a written scope, so node, kernel and runtime checks, pilot results and handover material are agreed before any production namespace changes.
How we scope
- Inventory which namespaces and workloads are candidates for pod.spec.hostUsers set to false.
- Confirm node operating systems, kernel versions and container runtime support across every node pool.
- Agree in writing which workloads are in scope, which are excluded, and how each pilot is judged.
How we build
- Prepare and verify node and runtime settings in a non-production cluster before enabling any pod.
- Test common workloads for breakage, including volume ownership, privileged settings and host-path access.
- Apply admission and policy controls so teams can review and standardize the hostUsers setting per namespace.
How we hand over
- Deliver a runbook covering prerequisites, rollout order, rollback steps and known workload exceptions.
- Document test evidence, including which pods were checked and what isolation behavior was confirmed.
- Walk your platform and security teams through the configuration so they can review and maintain it.
How we support
- Offer ongoing support and upgrade work as a retainer once the rollout is handed over.
- Retest affected workloads when Kubernetes, the container runtime or node kernels are upgraded.
- Confirm the support boundaries, response expectations and retest cadence in the written agreement.

