A Kubernetes security context controls the identity, group membership, filesystem group, and host privileges available to a container at runtime. Apply least privilege because a container breakout can expose host resources when the process runs as root. section 13.6.1 section 13.6.2
Configure the context to control two distinct security dimensions:
- Set runAsUser, runAsGroup, and fsGroup to run the container with a specified user, group, and filesystem group. section 13.6.1
- Set privileged to allow or deny elevated host privileges; privilege alone does not give a nonroot user permission to change kernel settings. section 13.6.2
- Treat root execution and privileged containers as separate controls, then define cluster policies to prevent unsafe combinations. section 13.6.2
spec: securityContext: runAsUser: 1500 runAsGroup: 1000 fsGroup: 1200
Use the manifest listing to see a Pod securityContext assigning UID 1500, group 1000, and filesystem group 1200. section 13.6.1
Privilege and user identity are independent
A busybox Pod running as root without privileged access cannot change host kernel settings. Allowing privileged access enables those changes for root, while a privileged container running as user 1000 remains denied. section 13.6.2



