Kubernetes Persistent Volumes

this has been revisted

In short, a Persistent Volume or pv (Kubernetes shorthand), is a storage resource for Kubernetes. Once a pv is set up it can be bound/reserved by a Persistent Volume Claim or pvc.

Normally you would have to provision a pv before you set up your pvc, but if you set up a StorageClass resource in your cluster, when you make a pvc that uses the storageClassName, Kubernetes will dynamically create that pv for you and bind your pvc to it.

pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sample-pvc
spec:
  storageClassName: $nameOfCreatedStorageClass
  resources:
    requests:
      storage: 200Gi
  accessModes:
    - ReadWriteOnce

Take a close look at where we have for accessModes. There are other options you can use which allow the following: