Do not admit root containers

Do not generally permit containers to be run as the root user.

Risk Level: Critical
Cloud Entity: Pods
CloudGuard Rule ID: D9.K8S.AC.08
Covered by Spectral: No
Category: Compute

GSL LOGIC

KubernetesPod should have (spec.containers contain-all [ securityContext.runAsNonRoot=true] or (spec.securityContext.runAsNonRoot=true and not spec.containers contain-any [ securityContext.runAsNonRoot=false])) and (spec.initContainers isEmpty() or ((spec.securityContext.runAsNonRoot=true and not spec.initContainers contain-any [ securityContext.runAsNonRoot=false]) or spec.initContainers contain-all [ securityContext.runAsNonRoot=true]))

REMEDIATION

Pods

Pods are the smallest deployable units of computing that can be created and managed in Kubernetes.A Pod is a group of one or more containers (such as Docker containers), with shared storage/network, and a specification for how to run the containers.

Compliance Frameworks

  • Container Admission Control