Question

How to provision Kubernetes Persistent Volumes to use with S3 or DO spaces

Hi,

I’m a beginner on k8s and I’ve been struggling for a long time trying to do Kubernetes storage the right way. I’ve learnt that stateless applications offers great performances and database shouldn’t be inside pods for performance/availability reasons.

So is there a way to use a S3-compatible API (like DO spaces) as a storage backend ? Ideally, I’d like to migrate my databases out of k8s in a managed SQL cluster, and use object storage for my newly created PVs. I could just use S3 directly in my applications, but this is sometimes not compatible with the design of the app (e.g: Nextcloud).

Thanks,


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

If I’m understanding your question, I think all you need to do is provide your application with configuration parameters to connect to whatever storage you need.

For example, in most of my applications, I’ll create a kubernetes secret that has my database name/address/password/etc., and then I’ll provide that data to my stateless pod as an environment variable. The application can then read the environment variable and connect to the database.

Does this answer your question?