Cheatsheet Pages / kubectl Cheatsheet

How to open a shell inside a running container — kubectl exec -it

You need to look around inside the running container — files, environment, processes.

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 exec -it web-6d9f7c5b4-x2abc -- sh    # sh exists almost everywhere; try bash too
kubectl exec web-6d9f7c5b4-x2abc -- env       # or run a single command, no shell
kubectl Cheatsheet one-page card — commands that actually work
The full one-page card — kubectl Cheatsheet. Get the complete cheatsheet on GitHub