Hey everyone! I've been using Kubernetes for a bit, but I still see myself as a newbie. I'm looking for advice on how to set up a file repository for an application our backend team has developed. The app needs to work with some executables, which it modifies and outputs as new executables. Currently, the design has the app accessing these files directly within the same container. I'm wondering if there's a better way to manage these files, rather than keeping them all on the same filesystem. One option I considered is utilizing MongoDB, but I'm open to suggestions. If that's not a good idea, what alternatives do I have? I'm thinking about creating a persistent volume (PV) attached to our Deployment where we could copy the new files via our CI/CD process each time we update the executables. Does that plan make sense? Any better approaches you'd recommend? Thanks in advance!
4 Answers
I wouldn't recommend using MongoDB or any database for storing binaries; they're not suited for that purpose. Instead, you should consider using an off-cluster object store like Amazon S3 or Azure Blob Storage. These services allow your containers to directly communicate with the object store, which is more scalable and resilient. You can also set it up so that your app can treat the object store like a directory, simplifying access and avoiding the need for SDK integration. Just keep in mind that configuring the storage can be tricky if you ever need to migrate clusters.
We manage our files using Google Cloud Storage since our Kubernetes is on Google Cloud. It's pretty straightforward to implement as most languages offer libraries for this. You can even mount the storage as a volume in your container, though talking to it directly is usually the smarter move. This way, you avoid added complexity.
For S3 storage, Minio can create an S3-like bucket you can use with your Kubernetes app. You can inject the S3 API secrets into the app as environment variables, allowing you to pull in whatever you need conveniently. Plus, Minio has a GUI for easy file uploads.
If you want seamless synchronization of executables to an object store without building in that functionality yourself, check out something like Archil. It provides a PV option that synchronizes with your GCS bucket automatically, making it super easy.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically