<p>I'm trying to share a cephfs volumes between namespaces within k8s cluster.
I'm using ceph-csi with cephfs.</p>
<p>Followed <a href="https://github.com/ceph/ceph-csi/blob/devel/docs/static-pvc.md#cephfs-static-pvc" rel="nofollow noreferrer">https://github.com/ceph/ceph-csi/blob/devel/docs/static-pvc.md#cephfs-static-pvc</a> to create static pv+pvc in both namespaces.
Works if I don't launch both pods on same node.</p>
<p>If both pods on same node, Second pod get stuck with error:</p>
<pre><code>MountVolume.SetUp failed for volume &quot;team-test-vol-pv&quot; : rpc error: code = Internal desc = failed to bind-mount /var/lib/kubelet/plugins/k
ubernetes.io/csi/pv/team-test-vol-pv/globalmount to /var/lib/kubelet/pods/007fc605-7fa4-4dc6-890f-fc0dabe5740b/volumes/kubernetes.io~csi/team-test-vol-pv/mount: an error (exit status 32) occurred while running mount arg
s: [-o bind,_netdev /var/lib/kubelet/plugins/kubernetes.io/csi/pv/team-test-vol-pv/globalmount /var/lib/kubelet/pods/007fc605-7fa4-4dc6-890f-fc0dabe5740b/volumes/kubernetes.io~csi/team-test-vol-pv/moun
</code></pre>
<p>Any ideas how to resolve this or how to use a single RWX volume in different NS?</p>
<p>PV+PVC for team-x:</p>
<pre><code>---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: test-vol
  namespace: team-x
spec:
  storageClassName: &quot;&quot;
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  volumeMode: Filesystem
  # volumeName should be same as PV name
  volumeName: team-x-test-vol-pv

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: team-x-test-vol-pv
spec:
  claimRef:
    namespace: team-x
    name: test-vol
  storageClassName: &quot;&quot;
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 1Gi
  csi:
    driver: cephfs.csi.ceph.com
    nodeStageSecretRef:
      name: csi-cephfs-secret-hd
      namespace: ceph-csi
    volumeAttributes:
      &quot;clusterID&quot;: &quot;cd79ae11-1804-4c06-a97e-aeeb961b84b0&quot;
      &quot;fsName&quot;: &quot;cephfs&quot;
      &quot;staticVolume&quot;: &quot;true&quot;
      &quot;rootPath&quot;: /volumes/team/share/8b73d3bb-282e-4c32-b13a-97459419bd5b
    # volumeHandle can be anything, need not to be same
    # as PV name or volume name. keeping same for brevity
    volumeHandle: team-share
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem

</code></pre>
<p>PV+PVC for team-y</p>
<pre><code>---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: test-vol
  namespace: team-y
spec:
  storageClassName: &quot;&quot;
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  volumeMode: Filesystem
  # volumeName should be same as PV name
  volumeName: team-y-test-vol-pv

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: team-y-test-vol-pv
spec:
  claimRef:
    namespace: team-y
    name: test-vol
  storageClassName: &quot;&quot;
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 1Gi
  csi:
    driver: cephfs.csi.ceph.com
    nodeStageSecretRef:
      name: csi-cephfs-secret-hd
      namespace: ceph-csi
    volumeAttributes:
      &quot;clusterID&quot;: &quot;cd79ae11-1804-4c06-a97e-aeeb961b84b0&quot;
      &quot;fsName&quot;: &quot;cephfs&quot;
      &quot;staticVolume&quot;: &quot;true&quot;
      &quot;rootPath&quot;: /volumes/team-y/share/8b73d3bb-282e-4c32-b13a-97459419bd5b
    # volumeHandle can be anything, need not to be same
    # as PV name or volume name. keeping same for brevity
    volumeHandle: team-share
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem
</code></pre>

<p>Having <code>volumeHandle: xyz</code> unique for each pv done the trick. Tested deploying 3xdaemonsets in 3 different namespaces.</p>
