<p>I'm trying to copy files from Kubernetes Pods to my local system. I am getting the below error while running following command: </p>

<pre><code>kubectl cp aks-ssh2-6cd4948f6f-fp9tl:/home/azureuser/test.cap ./test.cap
</code></pre>

<p>Output:</p>

<blockquote>
  <p>tar: home/azureuser/test: Cannot stat: No such file or directory tar:
  Exiting with failure status due to previous errors error:
  home/azureuser/test no such file or directory</p>
</blockquote>

<p>I could see the file under above given path. I am really confused.</p>

<p>Could you please help me out?</p>

Girish
<p>As stated in<code>kubectl</code> help:</p>
<pre><code>kubectl cp --help
Copy files and directories to and from containers.
Examples:
# !!!Important Note!!!
# Requires that the 'tar' binary is present in your container
# image.  If 'tar' is not present, 'kubectl cp' will fail.

# Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace
kubectl cp /tmp/foo_dir &lt;some-pod&gt;:/tmp/bar_dir

# Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container
kubectl cp /tmp/foo &lt;some-pod&gt;:/tmp/bar -c &lt;specific-container&gt;

# Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace &lt;some-namespace&gt;
kubectl cp /tmp/foo &lt;some-namespace&gt;/&lt;some-pod&gt;:/tmp/bar

# Copy /tmp/foo from a remote pod to /tmp/bar locally
kubectl cp &lt;some-namespace&gt;/&lt;some-pod&gt;:/tmp/foo /tmp/bar

Options:
-c, --container='': Container name. If omitted, the first container in the pod will be chosen

Usage:
kubectl cp &lt;file-spec-src&gt; &lt;file-spec-dest&gt; [options]

Use &quot;kubectl options&quot; for a list of global command-line options (applies to all commands).
</code></pre>
<p>You can also login to your <code>Containter</code> and check if file is there:</p>
<pre><code>kubectl exec -it aks-ssh2-6cd4948f6f-fp9tl /bin/bash
ls -la /home/azureuser/test.cap
</code></pre>
<p>If this still doesn't work, try:</p>
<blockquote>
<p>You may try to copy your files to workdir and then retry to copy them using just their names. It's weird, but it works for now.</p>
</blockquote>
<p>Consider advice of <a href="https://github.com/kchugalinskiy" rel="noreferrer">kchugalinskiy</a> here <a href="https://github.com/kubernetes/kubernetes/issues/58692" rel="noreferrer">#58692</a>.</p>
