A hostPath volume mounts a specific file or directory from a worker node’s filesystem into a pod. Most application pods should not depend on node-local files; system-level pods may need them to read logs, access devices, or interact with node components. section 9.4 section 9.4.1
Host-local storage has several important operational properties:
- Pods using the same hostPath on the same node can access the same files, while pods on other nodes cannot. section 9.4.1
- A database can lose access to its data after rescheduling unless it is kept on the same node, so hostPath is not generally suitable for database storage. section 9.4.1
- The optional type setting checks whether the path is a directory, file, block device, character device, or UNIX socket; creation variants can create missing files or directories. section 9.4.2
- Unrestricted hostPath access is dangerous because a pod may modify node configuration, run processes on the node, or expose the Docker socket. section 9.4.1
Mounting the node root
A pod can define hostPath.path as / and mount it at /host. After applying the manifest, kubectl exec -it node-explorer -- sh opens a shell; cd /host reaches the worker node’s root filesystem. This deliberately dangerous example demonstrates why hostPath use requires care. section 9.4.2
Figure 9.14 A hostPath volume mounts a file or directory from the worker node’s filesystem into the container.
Shows how a hostPath volume maps a worker-node file or directory into a container. section 9.4.1

