<p>I am currently learning Kubernetes and I'm stuck on how to handle the following situation:</p>

<p>I have a Spring Boot application which handles files(photos, pdf, etc...) uploaded by users, users can also download these files. This application also produces logs which are spread into 6 different files. To make my life easier I decided to have a root directory containing 2 subdirectories(1 directory for users data and 1 for logs) so the application works only with 1 directory(<code>appData</code>)</p>

<pre><code>.appData
     |__ usersData
     |__ logsFile
</code></pre>

<p>I would like to use GKE (Google Kubernetes Engine) to deploy this application but I have these problems: </p>

<ul>
<li><strong>How to handle multiple replicas which will read/write concurrently data + logs in the <code>appData</code> directory?</strong> </li>
<li>Regarding logs, is it possible to have multiple Pods writing to the same file?</li>
<li>Say we have 3 replicas (Pod-A, Pod-B and Pod-C), if user A uploads a file handled by Pod-B, how Pod-A and Pod-C will discover this file if the same user requests later its file?</li>
<li>Should each replica have its own volume? (I would like to avoid this situation, which seems the case when using StatefulSet)</li>
<li>Should I have only one replica? (using Kubernetes will be useless in that case)</li>
</ul>

<p>Same questions about database's replicas.
I use <code>PostgreSQL</code> and I have the same questions. If we have multiple replicas, as requests are randomly send to replicas, how to be sure that requesting data will return a result?</p>

<p>I know there a lot of questions. Thanks a lot for your clarifications.</p>

akuma8
<p>You can use persistent volume using NFS in GKE (Google Kubernetes Engine) to share files across pods.
<a href="https://cloud.google.com/filestore/docs/accessing-fileshares" rel="nofollow noreferrer">https://cloud.google.com/filestore/docs/accessing-fileshares</a></p>
