kubectl-node-shell icon indicating copy to clipboard operation
kubectl-node-shell copied to clipboard

How to copy binary data to stdout?

Open guettli opened this issue 6 months ago • 0 comments

I try to get a files or directories like this:

k node-shell mynode  -- tar -czf- /var/log/... > o.tgz

But this fails, because tar does not write to a tty:

tar: Refusing to write archive contents to terminal (missing -f option?) tar: Error is not recoverable: exiting now

Is there a way to make node-shell not create a tty?

I tried this workaround:

k node-shell mynode  -- sh -c "tar -czf- /var/log/... |cat" > o.tgz

But this seems to alter the binary data slightly. Extracting it does not work:

gzip: stdin: invalid compressed data--format violated


It would be really great if output of binary data would be supported.

guettli avatar May 22 '25 06:05 guettli