Shared PersistenceVolumeClaim(PVC) across namespaces

19,151

Solution 1

It looks impossible, just because PersistentVolumeClaim is a namespaced object. You can look detailed answer here: https://stackoverflow.com/a/35366775/9065705

Solution 2

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.

Share:
19,151

Related videos on Youtube

Obidul Islam
Author by

Obidul Islam

Updated on June 04, 2022

Comments

  • Obidul Islam
    Obidul Islam almost 2 years

    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.

  • Prathamesh dhanawade
    Prathamesh dhanawade almost 3 years
    Hi. Is there any online example available for this? I am using Azure FS with RWMany. How do we "point volumes in different namespace to one pvc" ?
  • BeGreen
    BeGreen over 2 years
    Could you link to documentation? I find nothing on pvc-shared-namespaces over kubernetes official documentation, or even on google.
  • Volodymyr Melnyk
    Volodymyr Melnyk over 2 years
    A nice idea, Jingyi, though the only place where this cool feature is mentioned is your comment here: github.com/kubernetes/kubernetes/issues/…. Wish it really would be a working solution, though it doesn't seems to be that. ;-(