Friday, January 08, 2021

kubectl cp from pod to local

  1. Get into the pod and make sure you locate the *relative* path of the file. When you run the shell in your pod you might land in root or in some other path so this is important
  2. Use as source of the relative path without "./" in the "kubectl cp" command after the name of the pod and a colon
  3. Use as target the local path (absolute or relative) of the *file* you want to create or replace as the result the "kubectl cp" command. The detination must be a file if the source is a file.
For example:
kubectl cp mypod:my/relative/path/in/my/pod/file.ext ~/file.ext

No comments:

Followers