CmdID

CmdID / Commands

kubectl-cp

Copy files and directories between a local filesystem and a container in a pod. tldr-pages

On several platforms

Opens CmdID with your command. It is read in your browser and sent nowhere.

Several platforms

from tldr-pages, CC BY 4.0

Copy a local file or directory to a pod

kubectl cp path/to/local_file pod_name:/path/to/file_in_podIdentify

Copy a local file or directory to a pod in a specific namespace

kubectl cp path/to/local_file namespace/pod_name:/path/to/file_in_podIdentify

Copy a file or directory from a pod to the local machine

kubectl cp namespace/pod_name:/path/to/file_in_pod path/to/local_fileIdentify

Copy a file or directory to a specific container in a pod

kubectl cp path/to/local_file pod_name:/path/to/file_in_pod --container container_nameIdentify
--containerContainer name. kubectl reference

Copy a file or directory to a pod without preserving ownership and permissions

kubectl cp path/to/local_file namespace/pod_name:/path/to/file_in_pod --no-preserveIdentify
--no-preserveThe copied file/directory's ownership and permissions will not be preserved in the container kubectl reference

Copy a local file or directory to a pod with retries on failure

kubectl cp path/to/local_file pod_name:/path/to/file_in_pod --retries 3Identify
--retriesSet number of retries to complete a copy operation from a container. kubectl reference