Longhorn persistent volume not support for multi pod bind

Hi,

During deployment , using longhorn persistent volume with replica 2. but getting error while trying to mount pvc on pods. will Longhorn persistent volume support for multi pod bind with different worker nodes ?

Could please guide.

Thanks
Bala

Hi @bala

Longhorn is a Read-Write-Once type storage for Kubernetes. It’s the same as AWS EBS and Google Persistent Disk, which can only be mounted on one node. It’s a distributed block storage solution rather than a distributed file system solution, so it cannot be written at the same time for the different nodes.

You can use StatefulSet with VolumeClaimTemplate instead of Deployment. Kubernetes would create a PVC per Pod, so that’s one Longhorn volume per Pod. In this way, you can scale your workload easily with Longhorn.

Thank You much Yasker for explained.

Could please guide me the right persistent volume solution with Read write Many in Rancher Kubernetes

You can take look at NFS.

Any solution to implement block storage as pv ?

Not sure what did you meant implement block storage a PV. Longhorn can be used as PV.

Though no block storage can support Read-Write-Many mode. It’s impossible since changing the storage content without filesystem knowing would result in data corruption.

Thanks Sheng Yang. Got it.

Will this work with replica: 3 on a single pod?

You can have 3 Longhorn replicas of a volume for a single pod.

So if I have 2 replicas of the same Nodejs they don’t share a single storage volume?

Hi and sorry for replying on an old post.

“You can use StatefulSet with VolumeClaimTemplate instead of Deployment. Kubernetes would create a PVC per Pod, so that’s one Longhorn volume per Pod.”

Will the content of the 3 volumes be in sync?

New to all this Kubernetes experience.

Cheers,

For Longhorn each volume, there is no relationship with others in Longhorn’s perspective. But the workload, a StatefulSet using these volumes for example, would write the same content to them.

You can create and access DigitalOcean Block Storage Volumes in a Kubernetes cluster by creating a PersistentVolumeClaim (PVC) as part of your deployment when you need to write and access persistent data. Using the Kubernetes command line tool, kubectl, this post will show you how to add volumes to your cluster.