<p>we're experimenting Kubernetes and thinking about migrating our webapp, currently hosted in a classic public cloud with vps and load balancing.</p>

<p>I'd like to know how to manage an upload folder (with write/read privileged) inside our dockerized app in which  files uploaded by our users are stored.</p>

<p>As we use lot of file uploading in our apps, would it be possible to have a persistent data storage in which the webapp can upload files in and manage them via webapp? Do I have to change the code of my app and save files to external object storages or there's a faster way to do it via local filesystem?</p>

<p>Thank you !</p>

<p>The persistent volume is the right way to go. You can read about it more in the link provided by Veerendra. For ease you can use some managed Kubernetes Engine like GKE/EKS/AKS as PV part is simplified there. You can find a good guide from GCP <a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/persistent-disk" rel="nofollow noreferrer">here</a>.  </p>

<p>About rewriting the application - probably there will be some small changes to do because you will need to use Pod level database. It will also be a more suitable solution as you will get an easy way to scale up and down with your app based on the load and couple of other features of Kubernetes. </p>

<p>I would not worry about LoadBalancer here. First you will dockerize your app then put it inside of a Pod which will be then a part of a Deployment then abstract the storage as PV. To get a grasp of how this all work you can start with this simple lab <a href="https://kubernetes.io/docs/tutorials/stateless-application/guestbook/" rel="nofollow noreferrer">Deploying PHP Guestbook application with Redis</a>. You can find another useful resource about using PV with Deployments and StatefulSets <a href="https://akomljen.com/kubernetes-persistent-volumes-with-deployment-and-statefulset/" rel="nofollow noreferrer">here</a>. </p>
