Apply security context to your pods and containers

kubernetes

Classification:

compliance

Framework:

cis-kubernetes

Control:

5.7.3

Set up the kubernetes integration.

Description

Apply security context to your pods and containers

Rationale

A security context defines the operating system security settings (UID, GID, capabilities, SELinux role, etc.) applied to a container. When designing your containers and pods, make sure that you configure the security context for your pods, containers, and volumes. A security context is a property defined in the deployment YAML. It controls the security parameters that will be assigned to the pod/container/volume. There are two levels of security context: pod level security context, and container level security context.

Audit

Review the pod definitions in your cluster and verify that you have security contexts defined as appropriate.

Remediation

Follow the Kubernetes documentation and apply security contexts to your pods. For a suggested list of security contexts, refer to the CIS Security Benchmark for Docker Containers.

Impact

If you incorrectly apply security contexts, you may have trouble running the pods.

Default value

By default, no security contexts are automatically applied to pods.

References

  1. https://kubernetes.io/docs/concepts/policy/security-context/
  2. https://learn.cisecurity.org/benchmarks

CIS controls

Version 6.3 Secure Configurations for Hardware and Software on Mobile Devices, Laptops, Workstations, and Servers