This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace | |
kubectl cp /tmp/foo_dir <some-pod>:/tmp/foo_dir | |
tar cf - /tmp/foo_dir | kubectl exec -i <some-pod> -- tar xf - | |
# Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container | |
kubectl cp /tmp/foo <some-pod>:/tmp/foo -c <specific-container> | |
tar cf - /tmp/foo | kubectl exec -i <some-pod> -c <specific-container> -- tar xf - | |
# Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace> | |
kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/foo |