Is it possible to reference a PVC (in namespace-A) from namespace-B. Why I need that? I would like to allow the customer (private cloud) to point their volume through PVC, allowing them full control of the storage. At the Helm install time will ask for PVC information and will be used in the pod spec.
It looks impossible, just because
PersistentVolumeClaim is a namespaced object. You can look detailed answer here: https://stackoverflow.com/a/35366775/9065705If you are using a ReadWriteMany-capable volume (like NFS/EFS), you can create multiple Persistent Volumes (PV) pointing to the same NFS volume, one for each namespace where you want to create a PVC. They can all use the same NFS volume at the same path, or specify different subPath to constrain them to certain directories.
Just in case someone arrives here from Google: It will now be possible with Kubernetes 1.26 (in Alpha): https://kubernetes.io/docs/concepts/storage/persistent-volumes/#cross-namespace-data-sources
pvc-shared-namespaces: NS1, NS2
pvc-ref: pvc-1 # the name of the source PVC
pvc-ref-namespace: pvc-1-ns # the namespace of the source PVC
CSI takes out pvc-ref and pvc-ref-namespace from CreateVolumeRequest.Parameters in CreateVolume interface:
Note: The returned VolumeId is the Spec.CSI.VolumeHandle field of the source PV. After finding the source PV, you can determine whether the persistentVolumeReclaimPolicy of the source PV is Retain. If not, refuse to create.