# Controlling PV and PVC binding

**URL:** <https://forums.suse.com/t/controlling-pv-and-pvc-binding/13126>\
**Category:** SUSE Rancher Prime\
**Created:** [January 27, 2019, 11:17pm UTC](https://forums.suse.com/t/controlling-pv-and-pvc-binding/13126 "2019-01-27T23:17:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thecabinet](https://avatars.discourse-cdn.com/v4/letter/t/e9c0ed/32.png) [@thecabinet](https://forums.suse.com/u/thecabinet)\
**Post date:** [January 27, 2019, 11:17pm UTC](https://forums.suse.com/t/controlling-pv-and-pvc-binding/13126/1 "2019-01-27T23:17:34Z")

</div>

I’m fairly new to Rancher but I have some experience from configuring Kubernetes at work.

I’m a little confused on volumes in Rancher. For example, I go to deploy the gitlab-ce chart and it creates four PVCs: data (RWO 10Gi), etc (RWO 1Gi), postgresql (RWO 10Gi), and redis (RWO 10Gi). Aside from the accessMode and the storage, there’s nothing to distinguish them, so how do I ensure that a PVC binds to a particular PV?

At work I would do this by adding labels to the PVs and matchLabels to the PVCs, but these aren’t even visible in the Rancher UI.

Thanks.

---

<div class="post-metadata">

**Author:** ![bkalai](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@bkalai](https://forums.suse.com/u/bkalai)\
**Post date:** [September 12, 2019, 5:50pm UTC](https://forums.suse.com/t/controlling-pv-and-pvc-binding/13126/2 "2019-09-12T17:50:15Z")

</div>

## I use kubectl to achieve this here is a pv definition apiVersion: v1 kind: PersistentVolume metadata: name: name-of-pv namespace: XXXX spec: storageClassName: “longhorn” capacity: storage: 2Gi volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain csi: driver: io.rancher.longhorn fsType: ext4 volumeAttributes: numberOfReplicas: ‘3’ staleReplicaTimeout: ‘30’ volumeHandle: xxxx you can use any CSI that works for you and here is the corresponding PVC

apiVersion: v1  
kind: PersistentVolumeClaim  
metadata: name-of the-claim  
namespace: xxxx  
selfLink: /api/v1/namespaces/xxxxx/persistentvolumeclaims/name-of the-claim  
spec:  
accessModes:

- ReadWriteOnce  
dataSource: null  
resources:  
requests:  
storage: 2Gi  
storageClassName: “longhorn”  
volumeMode: Filesystem  
volumeName: volume name from the pv definition

I hope this helps
