Do not admit root containers

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

Risk Level: High
Cloud Entity: Pods
CloudGuard Rule ID: D9.K8S.IAM.19
Covered by Spectral: Yes
Category: Compute

GSL LOGIC

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

REMEDIATION

Create a PSP as described in the Kubernetes documentation, ensuring that the .spec.runAsUser.rule is set to either MustRunAsNonRoot or MustRunAs with the range of UIDs not including 0.

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

  • CIS Amazon Elastic Kubernetes Service (EKS) Benchmark v1.1.0
  • CIS Kubernetes Benchmark v1.4.0
  • Kubernetes NIST.SP.800-190
  • Kubernetes v.1.13 CloudGuard Best Practices
  • Kubernetes v.1.14 CloudGuard Best Practices