<p>Is it possible to know the progress of file transfer with <code>kubectl cp</code> for <strong>Google Cloud</strong>?</p>

akshitsethi
<p>No, this doesn't appear to be possible.</p>

<p><code>kubectl cp</code> <a href="https://github.com/kubernetes/kubernetes/blob/release-1.13/pkg/kubectl/cmd/cp/cp.go#L292" rel="noreferrer">appears to be implemented</a> by doing the equivalent of</p>

<pre class="lang-sh prettyprint-override"><code>kubectl exec podname -c containername \
  tar cf - /whatever/path \
| tar xf -
</code></pre>

<p>This means two things:</p>

<ol>
<li><p><strong>tar</strong>(1) doesn't print any useful progress information.  (You could in principle add a <code>v</code> flag to print out each file name as it goes by to stderr, but that won't tell you how many files in total there are or how large they are.)  So <code>kubectl cp</code> as implemented doesn't have any way to get this out.</p></li>
<li><p>There's not a richer native Kubernetes API to copy files.</p></li>
</ol>

<p>If moving files in and out of containers is a key use case for you, it will probably be easier to build, test, and run by adding a simple HTTP service.  You can then rely on things like the HTTP <code>Content-Length:</code> header for progress metering.</p>
