<p>I have a pod that needs to create a lot of jobs.
I'd like to share a read-only folder.
How can I do it?</p>
<p>Several ideas I can imagine (I'm newbie to Kubernetes):</p>
<ul>
<li>Ephemeral volumes seem a good choice, but I've read it cannot be shared with another pod.</li>
<li>I thihk NFS is an overkill, too much for my needs.</li>
<li>Maybe, I could build a data only Docker image, but this is a deprecated feature of Docker.</li>
<li><code>kubectl cp</code> to copy the data between the base pod to the pod in the job.</li>
</ul>
<p>What would be the better solution for this?</p>

david.perez
<p>You can use a <code>PersistentVolume</code> and mount it as read only volume inside the pod via <code>PersistentVolumeClaim</code>. To mount a read only volume, set <code>.spec.containers[*].volumeMounts[*].readOnly</code> to <code>true</code>.</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
    - name: myfrontend
      image: nginx
      volumeMounts:
      - mountPath: &quot;/var/www/html&quot;
        name: mypd
        readOnly: true
  volumes:
    - name: mypd
      persistentVolumeClaim:
        claimName: myclaim
</code></pre>
<p>Check out these links:</p>
<ol>
<li><a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims</a></li>
<li><a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistent-volumes" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistent-volumes</a></li>
</ol>
