kubectl-cp
copies files and directories between local filesystem and containers in pods
TLDR
Copy file to pod
$ kubectl cp [localfile] [pod-name]:[/path/in/container]
Copy file from pod$ kubectl cp [pod-name]:[/path/in/container] [localfile]
Copy to specific container$ kubectl cp [localfile] [pod-name]:[path] -c [container]
Copy entire directory$ kubectl cp [localdir] [pod-name]:[/remote/dir]
SYNOPSIS
kubectl cp src dest [options]
DESCRIPTION
kubectl cp copies files and directories between local filesystem and containers in pods. Uses tar internally, so tar must be present in the container. Supports copying in both directions.
PARAMETERS
-c, --container name
Container name in multi-container pod.-n, --namespace name
Kubernetes namespace.--no-preserve
Do not preserve file permissions.
CAVEATS
Requires tar to be installed in the container. Large file transfers may be slow as data is streamed through the API server.
SEE ALSO
kubectl(1), kubectl-exec(1)
