Interview Prep/Kubernetes/Pod startup failures

The app crashes with `open /tmp/cache/x: read-only file system` after the security team enforced a new policy.

BeginnerTroubleshootingPod startup failures
Answer

Likely causes → readOnlyRootFilesystem: true is now set (by policy mutation or the restricted baseline), and the app writes to /tmp, a cache dir or its own install dir.

Diagnose →

kubectl get pod web-x -o jsonpath='{.spec.containers[0].securityContext.readOnlyRootFilesystem}'
kubectl logs web-x --previous | grep -i 'read-only'

Fix → Keep the root filesystem read-only and mount writable emptyDir volumes only where needed:

volumeMounts:
  - {name: tmp, mountPath: /tmp}
volumes:
  - name: tmp
    emptyDir: {sizeLimit: 256Mi}

Prevent → Develop and test with read-only root from day one; document writable paths per app.

All Kubernetes questions Roadmap: Kubernetes core

More on Pod startup failures