Container Hardening
Cheat sheet · https://pcornel.dk/topic.php?topic=5045
Answer
Container hardening reduces attack surface: minimal base images, non-root users, read-only file systems, dropped capabilities, seccomp and AppArmor or SELinux profiles, and resource limits.
Remember
- Minimal base images have fewer vulnerabilities.
- Run as non-root with a read-only file system.
- Drop all capabilities and add back only what is needed.
First checks
kube-bench run --targets node,master— CIS Kubernetesdocker-bench-security— CIS Docker- Restricted PSA + network policies — cluster hardening
Verify in this order
benchmark → config → scan → fix
Where it usually breaks
First mismatch in platform/workload identity → desired configuration → management/control plane → runtime enforcement → telemetry → workload/resource outcome; preserve identity/policy/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5045