Why is running containers as root a problem?
BeginnerScenarioSecurity, RBAC and policy
Answer
Situation read → A scan flags many containers running as UID 0.
What I'd do →
- Root in the container is root on the shared kernel if an escape occurs
- Set
runAsNonRootand build images with a non-rootUSER - Fix file ownership with
fsGroup - Verify with
kubectl exec -- id - Enforce with PSA
Why → Least privilege reduces the effect of a container escape.
Interview tip → Mention user namespaces as an extra layer.
More on Security, RBAC and policy
A developer needs read-only access to one namespace. How do you grant it?BeginnerExplain the difference between Role, ClusterRole, RoleBinding and ClusterRoleBinding.IntermediateA CI pipeline needs to deploy to one namespace. What identity do you give it?IntermediateWhat does a ServiceAccount do and why should you disable the token automount?BeginnerHow do you let pods on EKS access S3 without static keys?IntermediateA pod has access to the node's IAM role through IMDS. How do you prevent credential theft?Advanced