Volumes
Similar to docker volumes, containers inside pod in kubernetes can also have volumes in specification.
pod.yaml
spec:
containers:
- volumeMounts:
- name: shared
mountPath: /shared # inside container
volumes:
- name: shared
hostPath:
- type: Directory
path: /shared # inside host/nodeThis should mount the container path /shared to host path /shared. /shared should be present on host prior to mounting it.
hostPath is one of the implementation of volume where host path is used as storage. Using hostPath is not an ideal choice and impose several security risks to the host being used. There are other implementations such as nfs etc.