Question 27
Domain 1: Application Design and BuildYou created a second pod from the same pod manifest, but it does not see the file at /etc/foo/passwd that was present in the first pod. Why, and what is the best fix?
Correct answer: A
Explanation
A pod’s container filesystem is ephemeral, so a file created inside one pod is not preserved when you create another pod from the same manifest. To share or retain data across pods, mount a PersistentVolume or another shared volume into both pods so the file lives outside the container filesystem.
Why each option is right or wrong
A. The file was created in an ephemeral container filesystem; use a PersistentVolume or shared volume mounted into both pods to preserve and share the data.
Under the Kubernetes pod model, each container’s writable layer is ephemeral and is discarded when that pod instance is replaced or recreated; the manifest alone does not persist files written inside the container filesystem. The correct remedy is to place the path on a volume backed by persistent storage: for example, a PersistentVolume claimed by a PersistentVolumeClaim, or another shared volume type mounted into both pods, so the data survives pod recreation and is visible to both instances.
B. The second pod must be scheduled on the same node as the first pod for /etc/foo to be visible.
C. Pods automatically share the root filesystem only when they have the same name; renaming the pod breaks file visibility.
D. The file is hidden by Kubernetes securityContext settings; adding privileged: true will make it appear.