How to provision a volume to multiple namespaces? #189
-
Consider that a filesystem or a directory on a Weka Storage must be consumed by many different users on a Kubernetes cluster. While this is trivial to do when all users are working in a shared namespace, it seems a bit tricky when every user operates in a separate namespace. That's because one cannot bind a PVC (a namespace-scoped object) to a pod living in a different namespace. Our solution to this is the following:
This procedure seems to have the desired effect: a pod in namespace A can bind a volume, write to it and any changes to the files can be simultaneously read back by another pod in namespace B. Now, given the comment about the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello, To use PersistentVolumeClaim in each Namespace:
This way, you have separate claims in each namespace, but they are bound to the same underlying PV. |
Beta Was this translation helpful? Give feedback.
Hello,
According to official Kubernetes documentation, a single storage entity can be represented by a single PersistentVolume only.
However, there might be multiple PersistentVolumeClaims (in different namespaces as well) that point to same persistent volume.
PersistentVolume objects are also global and not bound to any namespace for that very reason.
Obviously, the volume should be provisioned statically.
To use PersistentVolumeClaim in each Namespace:
Create a separate PersistentVolumeClaim in each namespace that references the same underlying PersistentVolume. For example: