<p>I created a persistent volume using the following YAML</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: dq-tools-volume
  labels:
    name: dq-tools-volume
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  storageClassName: volume-class
  nfs:
    server: 192.168.215.83
    path: "/var/nfsshare"
</code></pre>

<p>After creating this I created  two persistentvolumeclaims  using following YAMLS</p>

<p><strong>PVC1:</strong></p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jenkins-volume-1
  labels:
    name: jenkins-volume-1
spec:
  accessMOdes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
  storageClassName: volume-class
  selector:
    matchLabels:
      name: dq-tools-volume
</code></pre>

<p><strong>PVC2:</strong></p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jenkins-volume-2
  labels:
    name: jenkins-volume-2
spec:
  accessMOdes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
  storageClassName: volume-class
  selector:
    matchLabels:
      name: dq-tools-volume
</code></pre>

<p>But i noticed that both of these persistent volume claims are writing to same backend volume.</p>

<p>How can i isolate data of one persistentvolumeclaim from another. I am using this for multiple installations of Jenkins. I want workspace of each Jenkins to be isolated.</p>

thinkingmonster
<p>As i understand <strong>it is not possible to bind two PVC to the same PV</strong>.</p>

<p>Refer this link > <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#binding" rel="nofollow noreferrer">A PVC to PV binding is a one-to-one mapping</a></p>

<p>You will possibly need to look into <a href="https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/" rel="nofollow noreferrer">Dynamic Provisioning option</a> for your setup.</p>

<p>Tested by creating one PV of 10G and two PVC with 8Gi an 2Gi claim request
PVC-2 goes into pending state.</p>

<pre><code>master $ kubectl get persistentvolume
NAME      CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS    CLAIM         STORAGECLASS   REASON    AGE
pv        10Gi       RWX            Retain           Bound     default/pv1                            7m


master $ kubectl get persistentvolumeclaims
NAME      STATUS    VOLUME    CAPACITY   ACCESS MODES   STORAGECLASS   AGE
pvc1       Bound     pv        10Gi       RWX                           3m
pvc2       Pending                                                      8s
</code></pre>

<p>Files used for creating PV and PVC as below</p>

<pre><code>master $ cat pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: /var/tmp/
</code></pre>

<pre><code>master $ cat pvc1.ayml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc1
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 8Gi
</code></pre>

<pre><code>master $ cat pvc2.ayml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc2
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 2Gi
</code></pre>
