Cheatsheet Pages / kubectl Cheatsheet

How to get logs from a crashed container — kubectl logs -p (CrashLoopBackOff)

The container keeps restarting (CrashLoopBackOff) and the current logs only show the new instance starting up.

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 logs -p web-6d9f7c5b4-x2abc   # CrashLoopBackOff? this is where the real error is

Good to know

This reads the logs of the previous, crashed container instance — where the real error usually is.

kubectl Cheatsheet one-page card — commands that actually work
The full one-page card — kubectl Cheatsheet. Get the complete cheatsheet on GitHub