I have created one Persistent volume in GCP k8s cluster
kind: PersistentVolume
apiVersion: v1
metadata:
name: test
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/xyz"
I would like understand the path "/mnt/xyz" is taking from ? I have checked the cluster nodes , didn't find the path "/mnt/xyz".
Can anyone please enlighten me on this. Thanks in advance.
Can anyone please enlighten me on this.
You can find a nice description of ‘hostPath’ in the official documentation. For some quick pointers:
In your case you have to create /mnt/xyz on each node, start pod, check on which node pod started and observe /mnt/xyz on that specific node get used by pod. Now, once you restart pod and if it gets rescheduled to another node you will see that on previous node state of /mnt/xyz is frozen at the moment first pod stopped running and on newly allocated node it is reinitialized to initial state and gets used.