A container works locally but fails in Kubernetes with "permission denied" writing to /app/data.
IntermediateHands-onLive debugging tasks
Answer
kubectl exec -it api-xyz -- id # uid=10001 (non-root, set by securityContext)
kubectl exec -it api-xyz -- ls -ld /app/data # owned by root:root
kubectl get pod api-xyz -o jsonpath='{.spec.securityContext}'
Fix: set securityContext.fsGroup: 10001 so mounted volumes are group-owned by the pod, or chown the directory in the Dockerfile. With readOnlyRootFilesystem: true, mount an emptyDir at that path.
Key trick → Locally you ran as root, but the cluster enforces non-root and possibly a read-only root filesystem. Compare id with the directory's owner.
More on Live debugging tasks
A pod is in CrashLoopBackOff. You have 10 minutes. Walk through your commands.BeginnerThe pod shows `OOMKilled`. Diagnose and fix it.BeginnerA pod is stuck in `ImagePullBackOff`. Fix it.BeginnerA pod is `Pending` forever. What do you check?AdvancedThe Service returns "connection refused" but pods are Running. Debug it.IntermediateA Docker container exits immediately after `docker run -d`. Find out why.Beginner