<p>I am trying to copy files from the pod to local using following command:</p>
<pre><code>kubectl cp /namespace/pod_name:/path/in/pod /path/in/local
</code></pre>
<p>But the <code>command terminates with exit code 126</code> and copy doesn't take place.</p>
<p>Similarly while trying from local to pod using following command:</p>
<pre><code>kubectl cp /path/in/local /namespace/pod_name:/path/in/pod
</code></pre>
<p>It throws the following error:</p>
<p><code>OCI runtime exec failed: exec failed: container_linux.go:367: starting container process caused: exec: &quot;tar&quot;: executable file not found in $PATH: unknown</code></p>
<p>Please help through this.</p>

<p><code>kubectl cp</code> is actually a very small wrapper around <code>kubectl exec whatever tar c | tar x</code>. A side effect of this is that you need a working <code>tar</code> executable in the target container, which you do not appear to have.</p>
<p>In general <code>kubectl cp</code> is best avoided, it's usually only good for weird debugging stuff.</p>
