Vinay:
Hi all , curious to know if we can share persistent volumes across namespaces ? can we do that or is there any workaround for it ?
Georges Jamous:
Sharing a screenshot, showing that the PV and not namespace dependent. However PVCs are.
Vinay:
So I can do this right…
creating a one storage class for dynamic provisioning instead of PV , and multiple PVC across namespace sharing the storage class ?
Georges Jamous:
Yes, StorageClass is a cluster-wide resource
Vinay:
But still that creates two different PV , my use case is to use the same PV for 2 pvc’s in different namespace.
Vinay:
will claimref sort this issue ?
Georges Jamous:
Unless i am mistaken:
A PVC to PV binding is a one-to-one mapping, you cannot use PV across multiple PVC at the same time.
However a PVC may be used across multiple Pods when the AccessMode is set to ReadWriteMany.
So in your case you cannot share a PV across NS since the PVC are namespace bound to start with.
https://kubernetes.io/docs/concepts/storage/persistent-volumes/
https://cloud.ibm.com/docs/containers?topic=containers-kube_concepts
Anand Joshi:
we can create pv in one namespace1 and can have a service account that can have access to this pv and then use this service account on a pod ?
Georges Jamous:
PVs are namespace independent, cluster-external.
Have no idea about service account part.