runAsNonRoot

A Kubernetes security setting that, when set to true, stops a container from starting if it would run as the root user.

In more detail

The kubelet checks which user the container would run as and refuses to start it if that is user 0, root. It can only check a numeric user, so the image must name its user by number, such as 65532, or runAsUser must be set to a non-zero number. The restricted Pod Security Standard requires it to be true, set for the whole pod or on each container.

Examples

securityContext:
  runAsNonRoot: true
securityContext:
  runAsNonRoot: true
  runAsUser: 10001
("runAsNonRoot true", get("runAsNonRoot") is True)

Related terms

Taught in

References

Certification courses