kubectl copying and transfering file to a pod without tar installed

In general we would have tar installed on a kubernetes pod. Sometimes when things are not happening, we can still copy to the container using the following command :- 

Copy to container


cat local-backup.tar.gz | kubectl exec -i -n cattle-resources-system \
rancher-backup-57c997f8cd-fxlb4 -c rancher-backup -- \
sh -c 'cat > /var/lib/backups/backup.tar.gz'

Copying from container 


kubectl exec -n cattle-resources-system rancher-backup-84576c498c-lpjh2 \
-c rancher-backup -- cat /var/lib/backups/default-location-recurring-backup-8723b2bd-e272-430e-89f6-14a133f8a417-2026-02-25T03-12-05Z.tar.gz \
> local-backup.tar.gz




Comments

Popular posts from this blog

vllm : Failed to infer device type

android studio kotlin source is null error

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20