kubectl cp web-7d8f9c:/app/config.json ./config.json

Category: Kubernetes & Containers

kubectl cp web-7d8f9c:/app/config.json ./config.json

Copy files out of a pod

Copies config.json from inside the pod to the current directory, useful for inspecting files that are not in the logs. The reverse direction works too, for example kubectl cp ./fix.sh web-7d8f9c:/tmp/fix.sh. Note that kubectl cp runs tar inside the pod, so it needs tar present in the container.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.