<p>I am trying to build an application which in essence consists of two parts. </p>

<ol>
<li>Django based api</li>
<li>SQLite database.</li>
</ol>

<p>Api interacts with the SQLite database, but has only read only access. However, the SQLite database needs to be updated every N minutes. So my plan was to make two docker container. First one, for the api. The second one, for the script which is executed every N minutes using CRON (Ubuntu) to update the database. </p>

<p>I am using Kubernetes to serve my applications. So I was wondering if there is a way to achieve what I want here? </p>

<p>I've researched about Persistent Volumes in Kubernetes, but still do not see how I can make it work.</p>

<p>EDIT:</p>

<p>So I have figured that I can use one pod two share two containers on Kubernetes and this way make use of the emptyDir. My question is then, how do I define the path to this directory in my python files?</p>

<p>Thanks,
Lukas </p>

<p>Take into account that <code>emptyDir</code> is erased every time the pod is stopped/killed (you do a deployment, a node crash, etc.). See the doc for more details: <a href="https://kubernetes.io/docs/concepts/storage/volumes/#emptydir" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/volumes/#emptydir</a></p>

<p>Taking that into account, if that solves your problem, then you just need to put the <code>mountPath</code> to the directory you want, as in the link above shows the example.</p>

<p>Take into account that the whole directory will be empty, so if you have other things there they won't be visible if you set up and <code>emptyDir</code> (just typical unix mount semantics, nothing k8s specific here)</p>
