<p>I am migrating a docker-compose file for a tomcat + postgres application to kubernetes.  My test environment is Dockers for Windows with Kubernetes enabled.</p>

<p>If I use an emptyDir volume for postgres, I am able to test my application successfully, but I am unable to persist postgres data.</p>

<pre><code>      volumes:
      - name: "pgdata-vol"
        emptyDir: {}
</code></pre>

<p>On MacOS, I am able to persist postgres data using a hostPath volume.</p>

<pre><code>  volumes:
  - name: "pgdata-vol"
    hostPath:
      path: /tmp/vols/pgdata
</code></pre>

<p>Unfortunately, if I try the same solution on Windows, I encounter a permission error.  This was discussed in a previous question. See  <a href="https://stackoverflow.com/questions/57227990/kubernetes-in-docker-for-windows-volume-configuration-for-postgres">Kubernetes (in Docker for Windows) Volume Configuration for Postgres</a>.</p>

<p>I do not need to access my volumes through the host file system.  I simply want my volume to persist from one run to the next.  I am able to achieve this behavior when running <code>docker-compose ... up</code> and <code>docker-compose ... down</code> using the following volume definition.</p>

<pre><code>volumes:
  pgdata:
</code></pre>

<p>Volume reference</p>

<pre><code>    environment:
      - PGDATA=/pgdata
    volumes:
      - pgdata:/pgdata
</code></pre>

<p>Is there a good name to use to describe this type of volume?  Is there a way to translate this type of volume into kubernetes?  </p>

<p>Empty dir is indeed for temporary data. 
If you need persistent data you have the choice between using a host path like in Docker, but if you have multiple nodes an a pod is scheduled for a different node the data will be missing. </p>

<p>A better solution is therefore to use a persistent volume. This must be provided by your infrastructure and is therefore specific to your environment.</p>

<p>See for details: <a href="https://kubernetes.io/docs/concepts/storage/volumes/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/volumes/</a></p>

<p>For the permission problem on Docker for Windows you might want to consider to use minikube instead. </p>
