Question

How to use Digital Ocean Volumes as persistent storage for the pod to share the storage across multiple pods?

I want to use Digital Ocean Volume to store the data which is shared across the pods on a same cluster. Multiple pods will be reading and writing from the same volume at a same time.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

DigitalOcean does not support parallel read/write modes unfortunately:

See: https://docs.digitalocean.com/products/kubernetes/how-to/add-volumes/

accessModes must be set to ReadWriteOnce. The other parameters, ReadOnlyMany and ReadWriteMany, are not supported by DigitalOcean volumes. See the Kubernetes documentation for more about …

In theory if all your pods run on the same node, they should be able to read/write together, but then you cannot scale out with multiple nodes. Also, you won’t be able to do a 0-downtime node replacement, since the second node cannot attach until the first one is down.

I am in need for a solution to this problem, but haven’t investigated yet. I suspect the solution to be in setting up a custom network fileserver (like nfs, or gluster) on kubernetes. It seems that kubernetes supports NFS as a volume option as well, so then you don’t need to modify container images to set up the mounting.

Hello,

When you need to write and access persistent data in a Kubernetes cluster, you can create and access DigitalOcean Block Storage Volumes by creating a PersistentVolumeClaim (PVC) as part of your deployment. I would recommend following the steps from the official DigitalOcean documentation on how to add Block Storage Volumes to a Kubernetes Cluster:

https://www.digitalocean.com/docs/kubernetes/how-to/add-volumes/

Hope that this helps! Regards, Bobby