<p>In most situations, my web applications do not assume /tmp will exist between requests. However certain web application projects write to /tmp, and then read the results in the following request, which <a href="https://www.drupal.org/project/webform/issues/2980276" rel="nofollow noreferrer">can cause issues if a web application is not served from a single container or server</a>. If I am moving to Kubernetes, is it generally considered a good practice to share the /tmp directory between containers, or is it better to move toward assuming that /tmp will change from one call to another.</p>

alberto56
<p>It isn't a good practice to share your /tmp folder between containers, but you can create a persistent volume with read-write-many permission:</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv0003
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Recycle
  storageClassName: slow
  mountOptions:
    - hard
    - nfsvers=4.1
  nfs:
    path: /tmp
    server: 172.17.0.2
</code></pre>

<p>and use it. </p>

<p>More information on how to use volumes you could find in <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="nofollow noreferrer">documentation.</a></p>
