How do you reduce the chance of container escape on a shared node pool?
AdvancedScenarioContainer and IaC Security
Answer
Situation read → Containers share the host kernel. Escapes use dangerous capabilities, privileged mode, host mounts or kernel bugs.
What I'd do →
- Forbid
privileged,hostPID,hostNetwork, hostPath and dangerous capabilities (PSArestricted). - Drop all capabilities, add back only what is needed; enable
seccompProfile: RuntimeDefault. - Use read-only root FS and non-root users.
- Keep the node OS patched, use a container-optimised OS (Bottlerocket, Flatcar).
- For untrusted workloads use sandboxed runtimes (gVisor, Kata Containers) via
RuntimeClass. - Detect with Falco rules for shell in container and sensitive mounts.
Why → Layers: restrict the process, restrict the kernel interface, isolate the kernel when trust is low.
Interview tip → Name seccomp, AppArmor and user namespaces.
More on Container and IaC Security
A team asks whether to use `ubuntu`, `alpine` or a distroless base image. How do you advise?Beginner`trivy image` shows 300 vulnerabilities in your app image. How do you bring this down?BeginnerA Dockerfile runs the app as root. How do you fix it and prove the fix?IntermediateCheckov fails a Terraform PR because an S3 bucket allows public access. What do you change?BeginnerHow do you set up image scanning so nothing vulnerable reaches production?IntermediateAn image passed scanning three weeks ago and runs in production. A new critical CVE is published today. What happens next?Intermediate