https://rancher.com/ logo
Title
h

helpful-beard-54962

10/31/2022, 9:45 AM
apiVersion: v1
kind: Pod
metadata:
  name: shared-storage-example
spec:
  volumes:
    - name: shared-data
      emptyDir: {}
  containers:
    - name: container-1
      image: nginx
      volumeMounts:
        - name: shared-data
          mountPath: /usr/share/nginx/html
    - name: container-2
      image: debian
      volumeMounts:
        - name: shared-data
          mountPath: /data
      command: ["/bin/sh"]
      args: ["-c", "echo Hello world > /data/index.html"]
This simple configuration doesn't work in Rancher 1. Started 1 deployment with this config 2. Increased the pods in the container to 3 3. The files created in
/data
are NOT shared between the 3 containers I do not want to use persistent volume claims because I don't need them to be persistent, I just need a folder to shared data ONLY between the pods in a deployment and for that data to be destroyed when the deployment is deleted
f

full-painter-23916

10/31/2022, 11:16 AM
Nor is it supposed to. An emptyDir is shared between multiple containers in one pod, not between multiple pods in a deployment (which may be scheduled to different nodes).
h

helpful-beard-54962

10/31/2022, 11:27 AM
Any idea how to share between pods in a deployment without Longhorn or NFS?
f

full-painter-23916

10/31/2022, 9:08 PM
I mean there are other similar things, but you cannot share storage without.. shared.. storage A hostPath will work if you have exactly one node (or are ok with one set of data per node shared with pods on a given node, but separate from other nodes)