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.
A PVC is a namespaced resource, Pods on different namespaces can't share the same PVC. Pods on different namespaces would need to use two different PVC resources.
TL;DR You can share PV and PVC within the same project/namespace for shared volumes (nfs, gluster, etc...), you can also access your shared volume from multiple project/namespaces but it will require project dedicated PV and PVCs, as a PV is bound to single project/namespace and PVC is project/namespace scoped.
Once a PV is bound to a PVC, that PV is essentially tied to the PVC's project and cannot be bound to by another PVC. There is a one-to-one mapping of PVs and PVCs. However, multiple pods in the same project can use the same PVC.
Namespaces are used to isolate resources within the control plane. For example if we were to deploy a pod in two different namespaces, an administrator running the “get pods” command may only see the pods in one of the namespaces. The pods could communicate with each other across namespaces however.
It looks impossible, just because PersistentVolumeClaim
is a namespaced object. You can look detailed answer here: https://stackoverflow.com/a/35366775/9065705
If 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With