Transferring files from a pod to a Linux shell

Procedure

  1. Obtain the name of the pod.
    Pod names have hashes in it that change each time a pod is started. To get the name of the current pods, issue the command:
    kubectl get pods 
  2. To copy a file from the pod, use the syntax below, and make the following substitutions:
    kubectl cp <podname>:/<filename> /<path_on_local>/<filename> --container=<container_name> 
    podname
    The name of the pod.
    filename
    The file name inside the pod.
    path_on_local
    The path on the machine running kubectl.
    container_name
    The name of the container. If the pod only has one container you can omit this parameter. See Pods in Sametime for container names.
    For example if:
    • The pod name is jitsi-7b86fc4f64-vtrrb
    • The container name is jigasi
    • The file name inside the pod is test1.pcap
    To save this file to the /tmp directory on the machine running kubectl, then the command is:
    kubectl cp jitsi-7b86fc4f64-vtrrb:/test1.pcap /tmp/test1.pcap --container=jigasi