<pre><code> kubectl cp namespace/podname:/path/target .
</code></pre>
<p>If I use the instructed command from kubernetes guide, it only copies the contents inside the <code>target</code> directory and omits <code>target</code> itself.<br />
I don't want to use <code>mkdir</code> every time I need to copy.<br />
What's the option?</p>

<p>Try <code>kubectl cp namespace/podname:/path/target target</code>. Note specify &quot;./target&quot; will receive a warning: &quot;tar: removing leading '/' from member names&quot;. Also, ensure your image have <code>tar</code> command or <code>kubectl cp</code> can fail.</p>
