Persistent Volume Claim to make the storage available to a node.
Persistent Volumes are resources in the cluster. Persistent Volume Claims are requests for those resources and also act as claim checks to the resource.
Persistent Volume and Persistent Volume Claims are two separate objects in the Kubernetes namespace. An administrator creates a set of Persistent Volumes and a user creates Persistent Volume Claims to use to storage. Once the persistent volume claims based on the request and properties set on the volume. Every Persistent Volume Claims is bound to a single persistent volume during the binding process Kubernetes tries to find a persistent volume that has sufficient capacity as requested by the claim and any other request properties such as access modes volume mode storage class etc.
There is a one to one relationship between Persistent Volume Claims and Persistent Volume so no other claims can utilize the remaining capacity in the volume.
If there are no volumes available the persistent volume claim will remain in a pending state until newer volumes are made available to the cluster. Once newer volumes are available, the claim would automatically be bound to the newly available volume.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/
Persistent Volume Claim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc-sample
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
$ kubectl create -f pvc-sample.yaml
persistentvolumeclaim/pvc-sample created
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-sample Bound pvc-bd57fd7b-3ec8-452d-9c05-4687585ff9ea 500Mi RWO hostpath 43s
jayjo@Jay-Mac minikub