Docker Certified Associate (DCA) — Question 14

During development of an application meant to be orchestrated by Kubernetes, you want to mount the /data directory on your laptop into a container.
Will this strategy successfully accomplish this?
Add a volume to the pod that sets hostPath.path: /data, and then mount this volume into the pod’s containers as desired.

Answer options

Correct answer: B

Explanation

The correct answer is 'No' because hostPath volumes in Kubernetes can only reference directories on the node where the pod is running, not from a laptop. Therefore, using hostPath.path: /data will not work unless the /data directory exists on the Kubernetes node.