title: kubernetes PVCs sharing a single PV?
body: <p>I am trying to deploy a persistentvolume for 3 pods to work on and i want to use the cluster's node storage i.e. not an external storage like ebs spin off.</p>
  
  <p>To achieve the above i did the following experiment's -</p>
  
  <p>1) I applied only the below PVC resource defined below -</p>
  
  <pre><code>apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    creationTimestamp: null
    labels:
      io.kompose.service: pv1
    name: pv1
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 1Gi
  status: {}
  </code></pre>
  
  <p>This spin's up a storage set by default storageclass, which in my case was digital ocean's volume. So it created a 1Gi volume.</p>
  
  <p>2) Created a PV resource and PVC resource like below -</p>
  
  <pre><code>apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: task-pv-volume
    labels:
      type: local
  spec:
    storageClassName: manual
    capacity:
      storage: 10Gi
    accessModes:
      - ReadWriteOnce
    hostPath:
      path: "/mnt/data"
  </code></pre>
  
  <hr>
  
  <pre><code>apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    creationTimestamp: null
    labels:
      io.kompose.service: pv1
    name: pv1
  spec:
    storageClassName: manual
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 1Gi
  status: {}
  </code></pre>
  
  <p>Post this i see my claim is bound.</p>
  
  <pre><code>    pavan@p1:~$ kubectl get pvc
      NAME        STATUS   VOLUME           CAPACITY   ACCESS MODES   STORAGECLASS   AGE
      pv1   Bound    task-pv-volume   10Gi       RWO            manual         2m5s
      pavan@p1:~$ kubectl get pv
      NAME             CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM               STORAGECLASS   REASON   AGE
      task-pv-volume   10Gi       RWO            Retain           Bound    default/pv1   manual                  118m
  pavan@p1:~$ kubectl describe pvc
  Name:          pv1
  Namespace:     default
  StorageClass:  manual
  Status:        Bound
  Volume:        task-pv-volume
  Labels:        io.kompose.service=pv1
  Annotations:   kubectl.kubernetes.io/last-applied-configuration:
                   {"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"creationTimestamp":null,"labels":{"io.kompose.service":"mo...
                 pv.kubernetes.io/bind-completed: yes
                 pv.kubernetes.io/bound-by-controller: yes
  Finalizers:    [kubernetes.io/pvc-protection]
  Capacity:      10Gi
  Access Modes:  RWO
  VolumeMode:    Filesystem
  Mounted By:    &lt;none&gt;
  Events:
    Type     Reason              Age                 From                         Message
    ----     ------              ----                ----                         -------
    Warning  ProvisioningFailed  28s (x8 over 2m2s)  persistentvolume-controller  storageclass.storage.k8s.io "manual" not found
  </code></pre>
  
  <p>Below are my questions that i am hoping to get answers/pointers to -</p>
  
  <ol>
  <li><p>The above warning, storage class could not be found, do i need to
  create one? If so, can you tell me why and how? or any pointer. (Somehow this link misses to state that - <a href="https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/</a>)</p></li>
  <li><p>Notice the PV has storage capacity of 10Gi and PVC with request capacity of 1Gi, but still PVC was bound with 10Gi capacity? Can't i share the same PV capacity with other PVCs?</p></li>
  </ol>
  
  <p>For question 2) If i have to create different PVs for different PVC with the required capacity, do i have to create storageclass as-well? Or same storage class and use selectors to select corresponding PV?</p>