Is it possible to know the progress of file transfer with kubectl cp
for Google Cloud?
No, this doesn't appear to be possible.
kubectl cp
appears to be implemented by doing the equivalent of
kubectl exec podname -c containername \
tar cf - /whatever/path \
| tar xf -
This means two things:
tar(1) doesn't print any useful progress information. (You could in principle add a v
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 kubectl cp
as implemented doesn't have any way to get this out.
There's not a richer native Kubernetes API to copy files.
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 Content-Length:
header for progress metering.
It's not possible, but you can find here how to implement rsync with kubernetes, rsync shows you the progress of the transfer file. rsync files to a kubernetes pod