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