Cheatsheet Pages / kubectl Cheatsheet

How to copy files in and out of a container — kubectl cp

A file inside the container — a dump or a log — needs to come out, or a config needs to go in.

Placeholders follow the cheatsheet: web is a deployment/pod name and app.yaml is your manifest. Most commands act on the current namespace — add -n <ns> to target another one.

kubectl cp web-6d9f7c5b4-x2abc:/tmp/dump.log ./   # container -> local
kubectl cp ./config.yaml web-6d9f7c5b4-x2abc:/etc/app/   # needs tar inside the container
kubectl Cheatsheet one-page card — commands that actually work
The full one-page card — kubectl Cheatsheet. Get the complete cheatsheet on GitHub