What do Kubernetes user namespaces (`hostUsers: false`) give you?
AdvancedProductionKubernetes Security Posture
Answer
With user namespaces, root (UID 0) inside the container maps to an unprivileged, high UID on the host. If a container escape happens, the attacker lands as a nobody user on the node instead of root. Several past container breakout CVEs would have been blocked by it.
spec:
hostUsers: false
containers:
- name: app
image: registry.example.com/app@sha256:...
The feature has been maturing through recent releases and needs a recent kernel, container runtime and filesystem idmap support. We enable it first for workloads that must run as root inside the container, where the benefit is largest.
More on Kubernetes Security Posture
What is your security baseline for a new production EKS cluster?IntermediateDraw the layered security controls for workloads on Kubernetes.BeginnerHow do you assign Pod Security Admission levels across namespaces in production?BeginnerKyverno, OPA Gatekeeper or ValidatingAdmissionPolicy: how do you choose?IntermediateShow a ValidatingAdmissionPolicy that blocks containers without resource limits.AdvancedHow do you roll out default-deny NetworkPolicies in a running production cluster?Intermediate