Best Way to Build a File Repository for My App in Kubernetes?
Asked by
CuriousCoder42
Hey everyone! I'm relatively new to Kubernetes and I need some help with a project I'm working on. Our backend team has built an application that needs to work with some files called executables. The app will modify these executables, so they need to be accessible during runtime. The current setup has the app accessing these files directly inside the same container, which seems like a questionable design to me.
I'm wondering if there's a better alternative than storing these files in the same filesystem. One thought I had was about using MongoDB for file storage, but I'm not sure if that's the best route. If that's not ideal, what would be the best approach? I was considering creating a Persistent Volume (PV) and linking it to our Deployment, so our CI/CD process can copy the new versions of the executables whenever updates happen. Does this plan make sense, or are there better options? Let me know if you need further details. Thanks for any input!
Answers
If you want a simple solution for syncing files without building in app support, check out Archil. It offers a Persistent Volume with limitless storage that synchronizes with your Google Cloud Storage bucket automatically. It simplifies the process significantly.
Reply to this answer
We use Google Cloud Storage for our files that need processing in Kubernetes. Most programming languages can easily connect to Cloud Storage, so implementing it is straightforward. Instead of treating it like a traditional mounted filesystem, directly interact with the storage using its APIโthis can simplify a lot of things.
Reply to this answer
Using a database like MongoDB for storing binaries isn't recommended; it's better to look at cloud object stores. For your use case, services like Amazon S3 or Azure Blob Storage are ideal. They allow your containers to communicate with the object store directly through SDKs. You could also mount these object stores as Persistent Volumes (PV) for your containers. This keeps things clean and scalable, but just be cautious about how you configure your storage as moving between clusters could get tricky.
Reply to this answer
You might consider using MinIO, which provides an S3-compliant interface. You can set it up to create an S3 bucket for your application in Kubernetes. The app can use S3 API keys as environment variables to download the necessary files. Plus, MinIO has an easy-to-use GUI for uploading files, which could be a helpful feature.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions