<p>I have scenario when my cluster consist of two microservices.</p>
<p>In service <strong>A</strong> i have .CSV(15MB) file, which also is needed in service <strong>B</strong>.</p>
<p>I don't want to place this file two times in each repo.</p>
<p>During deployment of service <strong>A</strong> I want to place this .csv file in some kind of shared volume, that pod containing service <strong>B</strong> can consume and process it.
Any ideas and best practices how to do it?</p>
<p>Best regards</p>

novja
<p>If you dont want to set it in the docker image, you can use the <strong>initcontainer</strong> to download when POD starts. You can set the file into the <strong>hostPath</strong> when <strong>service A</strong> starting.</p>
<p>When you say <strong>service A</strong> has file not sure if it's in the <strong>repo</strong> or it's part of <strong>Docker image</strong> build. If not part of the repo and it's stored at some central place like Bucket you can download it when <strong>service B</strong> starts with <strong>initcontainer</strong>.</p>
<p>Example downloading file and set &amp; share to hostpath:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: init-demo
spec:
  containers:
  - name: nginx
    image: nginx
    ports:
    - containerPort: 80
    volumeMounts:
    - name: save-data
      mountPath: /data-dir
  initContainers:
  - name: install
    image: ubuntu
    command: ['curl', 'download-link-path &gt;', '/tmp/file.csv']
    volumeMounts:
    - name: save-data
      mountPath: &quot;/data-dir&quot;
  dnsPolicy: Default
  volumes:
  - name: save-data
    hostPath:
      path: /data-dir
      type: Directory
</code></pre>
<p>other option is to set the shared file system which multiple PODs can attach and use same time. <strong><a href="https://stackoverflow.com/a/57798369/5525824">ReadWriteMany</a></strong> or <strong><a href="https://stackoverflow.com/a/57798369/5525824">ReadOnlyMany</a></strong> option.</p>
<ul>
<li><a href="https://min.io/" rel="nofollow noreferrer">Minio</a></li>
</ul>
<p>is very good option to use for above scenario.</p>
