<p>I have had some difficulties copying files from a kubernetes pod container (<strong>windows</strong> nodes) to my local linux subsystem on windows 10:</p>

<pre><code>t@11DT:/mnt/c/dev/auto$ kubectl cp a8677:c:\testlog2.txt .
tar: Removing leading drive letter from member names
error: tar contents corrupted
t@11DT:/mnt/c/dev/auto$ kubectl cp a8677:/c/testlog2.txt ./
tar: /c/testlog2.txt: Couldn't find file: No such file or directory
tar: Error exit delayed from previous errors.
t@11DT:/mnt/c/dev/auto$ kubectl cp a8677:c:\testlog2.txt ./
tar: Removing leading drive letter from member names
error: tar contents corrupted
t@11DT:/mnt/c/dev/auto$ kubectl cp a8677:c:/testlog2.txt ./
tar: Removing leading drive letter from member names
error: tar contents corrupted
t@11DT:/mnt/c/dev/auto$ kubectl cp a8677:c:/testlog2.txt ./t2.txt
tar: Removing leading drive letter from member names
error: tar contents corrupted
t@11DT:/mnt/c/dev/auto$ kubectl cp a8677:c:\testlog2.txt ./t2.txt
tar: Removing leading drive letter from member names
error: tar contents corrupted
</code></pre>

<p>The file <code>c:\testlog2.txt</code> definitely existed in pod a8677. But how to address <code>c:\testlog2.txt</code> appropriately?</p>

<hr>

<p><strong>Note:</strong> </p>

<p>Some moderators suggested to close this question, as it is a duplicate of <a href="https://stackoverflow.com/questions/52407277/how-to-copy-files-from-kubernetes-pods-to-local-system">How to copy files from kubernetes Pods to local system</a> . The existing question is about how to copy files in general between linux nodes in kubernetes clusters and linux local systems. This information is covered in the Kubernetes documentation (<a href="https://kubectl.docs.kubernetes.io/pages/container_debugging/copying_container_files.html" rel="noreferrer">https://kubectl.docs.kubernetes.io/pages/container_debugging/copying_container_files.html</a>). </p>

<p>This question here is specifically about <strong>windows</strong> containers. It seems to be neither covered in the kubernetes documentation, nor in any other question I found on stackoverflow. Many things that are straightforward in kubernetes linux nodes need a bit extra research for windows nodes.</p>

<p>I therefore do not think it is a duplicate.</p>

<p>The correct way is, to omit the drive letter:</p>

<p><code>kubectl cp &lt;pod_name&gt;:filename</code></p>

<p>for example:</p>

<p><code>kubectl cp a8677:testlog2.txt ./t2.txt</code></p>

<p>If the file is inside a subdirectory, the path needs to contain slashes, and no backslashes:</p>

<pre><code>kubectl cp a8677:my/file/path/file.txt ./myfile.txt
</code></pre>
