Can one persistent volume by consumed by several persistent volume claims?

10/10/2016

Is it correct to assume that one PV can be consumed by several PVCs and each pod instance needs one binding of PVC? I'm asking because I created a PV and then a PVC with different size requirements such as:

kind: PersistentVolume
apiVersion: v1
metadata:
  name: k8sdisk
  labels:
    type: amazonEBS
spec:
  capacity:
    storage: 200Gi
  accessModes:
    - ReadWriteOnce
  awsElasticBlockStore:
    volumeID: vol-xxxxxx
    fsType: ext4


kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: couchbase-pvc
  labels:
    type: amazonEBS
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi

But when I use the PVC with the pod, it shows as 200GB available instead of the 5GB.

I'm sure I'm mixing things, but could not find a reasonable explanation.

-- Vinicius Carvalho
kubernetes

1 Answer

10/10/2016

When you have a PVC it will look for a PV that will satisfy it's requirements, but unless it is a volume and claim in multi-access mode (and there is a limited amount of backends that support it, like ie. NFS - details in http://kubernetes.io/docs/user-guide/persistent-volumes/#access-modes), the PV will not be shared by multiple PVC. Furthermore, the size in PVC is not intended as quota for the amount of data saved on the volume during pods life, but as a way to match big enough PV, and thats it.

-- Radek 'Goblin' Pieczonka
Source: StackOverflow