<p>I have a running Gitlab CI pipeline in my Kubernetes cluster.</p>

<p>When the tests are failing, I need to grab the app screenshots and logs from the pod where it ran so that they are available where the Gitlab Runner is expecting them.</p>

<p>I tried the <code>kubectl cp &lt;namespace&gt;/&lt;podname&gt;:/in-pod-path /local/path</code> to copy the files from a stopped pod (having the <code>tar</code> command installed in my Docker image), but <a href="https://github.com/kubernetes/kubectl/issues/454" rel="nofollow noreferrer">it isn't yet supported</a>.</p>

<p>Until this is available, I guess I need a volume mounted in the pod at the path where are saved my artefacts so that I can grab them from this volume after the tests execution is finished.</p>

<p>I'm wondering <strong>what kind of volume should I use</strong> knowing that I have 3 kube workers, I don't need that volume to be persistent over time, more to be shared across the nodes?</p>

<p>I'm expecting to deploy this volume before deploying the pod running my tests mounting this volume. When tests failure is detected, I would extract the artefacts to the right place and delete the pod and the volume.</p>

<p>You could try and define a PVC with access mode <code>ReadWriteMany</code>, in order to get a volume shared between multiple pods.<br>
See "<a href="https://stackoverflow.com/a/52564314/6309">How to share storage between Kubernetes pods?</a>"</p>

<p>It would still be a persistent volume (to support that), with all the pods scheduled to the node with that volume.</p>

<blockquote>
  <p>There are several volume types that are suitable for that and not tied to any cloud provider:</p>
  
  <ul>
  <li>NFS</li>
  <li>RBD (Ceph Block Device)</li>
  <li>CephFS</li>
  <li>Glusterfs</li>
  <li>Portworx Volumes</li>
  </ul>
</blockquote>

<p>But:</p>

<blockquote>
  <p>I don't really need to share the volume between many pods, I'm fine to create a volume per pods.<br>
  I'd like to avoid installing/configuring a node shared volume service from the list you gave.<br>
  I'm looking for an <strong>ephemeral volume</strong> if that is possible? </p>
</blockquote>

<p>Then an <strong><a href="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#local-ephemeral-storage" rel="nofollow noreferrer">ephemeral <em>storage</em></a></strong>  is possible:</p>

<blockquote>
  <p>Kubernetes version 1.8 introduces a new resource, ephemeral-storage for managing local ephemeral storage. In each Kubernetes node, kubelet’s root directory (<code>/var/lib/kubelet</code> by default) and log directory (<code>/var/log</code>) are stored on the root partition of the node.<br>
  This partition is also shared and consumed by Pods via <code>emptyDir</code> volumes, container logs, image layers and container writable layers.</p>
</blockquote>

<p>In your case, you need a <a href="https://docs.openshift.com/container-platform/3.10/architecture/additional_concepts/ephemeral-storage.html#section-type-runtime" rel="nofollow noreferrer">runtime ephemeral storage</a>.</p>
