You can use hostPath volume.
A hostPath
volume mounts a file or directory from the host node’s filesystem into your Pod.
apiVersion: v1
kind: PersistentVolume
metadata:
name: task-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/path/in/master/infiles"
Check this guide on how to use hostPath.
A better option would be to use local volume.
apiVersion: v1
kind: PersistentVolume
metadata:
name: example-pv
spec:
capacity:
storage: 100Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
storageClassName: local-storage
local:
path: "/path/in/master/infiles"
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- example-node
Compared to hostPath volumes, local volumes can be used in a durable and portable manner without manually scheduling Pods to nodes, as the system is aware of the volume’s node constraints by looking at the node affinity on the PersistentVolume.
Edit:
The problem with storing data in the filesystem of the nodes itself is that there is no way to sync the data between the nodes. If this is needed for the application then using a PV backed by NFS in ReadWriteMany(RWX) mode is a better option. Here is guide on how to make this work in digital ocean.