Longhorn: ReadWriteMany access mode is not supported

Created on 29 May 2018  路  4Comments  路  Source: longhorn/longhorn

In case of a deployment (replication), ReadWriteMany is needed.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: longhorn-volv-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: longhorn
resources:
requests:
storage: 2Gi

Will be the feature possible in the future?

wontfix

Most helpful comment

@rbq

RWX means the volume can be mounted as read-write by many *nodes*. So it's per node, not per pod. In this case, since all the pods are created on the same node, it's still per node. Once the pod gets scheduled away, Longhorn would error out since it cannot be attached to two nodes at the same time. So far it seems Kubernetes doesn't ask beforehand if the driver can be RWO or RWX, so there isn't a way to warn user before the actual attach happens.

You can use Longhorn for multiple pods on the same node with RWO too.

All 4 comments

It's not possible for Longhorn to support ReadWriteMany, as with EBS and Google Persistent Disk. Block storage system will be presented as a disk on the host, and OS will put a filesystem on top of it. Any change in the block layer without the filesystem knowing will corrupt the data. So there cannot be multiple writer to a volume at the same time.

Thanks die info.

A user managed to create a Longhorn-backed ReadWriteMany PVC that seems to be mounted in a couple of Pods on the same node. So I checked the Rancher UI and didn't see any warning or validation that would stop me from creating those. What am I missing? Does this somehow actually work? Is it safe?

@rbq

RWX means the volume can be mounted as read-write by many *nodes*. So it's per node, not per pod. In this case, since all the pods are created on the same node, it's still per node. Once the pod gets scheduled away, Longhorn would error out since it cannot be attached to two nodes at the same time. So far it seems Kubernetes doesn't ask beforehand if the driver can be RWO or RWX, so there isn't a way to warn user before the actual attach happens.

You can use Longhorn for multiple pods on the same node with RWO too.

Was this page helpful?
0 / 5 - 0 ratings