Interview Prep/Kubernetes/Configuration, Secrets and storage

A pod needs a read-only config file and a writable temp dir, with `readOnlyRootFilesystem: true`. How?

IntermediateScenarioConfiguration, Secrets and storage
Answer

Situation read → The security team requires an immutable container filesystem.

What I'd do →

  1. Set securityContext.readOnlyRootFilesystem: true
  2. Mount ConfigMap files with readOnly: true
  3. Add emptyDir volumes for /tmp and any cache directories the app writes
  4. Check logs for "Read-only file system" errors and add paths accordingly
  5. Verify with kubectl exec -- touch /x

Why → Immutable roots limit what an attacker can persist, and emptyDir gives the app the few writable paths it needs.

Interview tip → Good place to mention runAsNonRoot and dropping capabilities too.

All Kubernetes questions Roadmap: Kubernetes core

More on Configuration, Secrets and storage