May 2018
Intermediate to advanced
554 pages
13h 51m
English
hostPath acts as data volume in Docker. The local folder on a node listed in hostPath will be mounted into the Pod. Since the Pod can run on any nodes, read/write functions happening in the volume could explicitly exist in the node on which the Pod is running. In Kubernetes, however, the Pod should not be node-aware. Please note that the configuration and files might be different on different nodes when using hostPath. Therefore, the same Pod, created by the same command or configuration file, might act differently on different nodes.
By using hostPath, you're able to read and write the files between containers and localhost disks of nodes. What we need for volume definition is for hostPath.path to specify the target mounted folder ...