What you will learn
- Read pod events and logs
- Exec into containers
- Debug pending and crashing pods
New to this? Start here
The basics, in plain English
When a Pod misbehaves, you need to look inside the cluster to find out why. These tools let you read a Pod’s state, view its logs, and even step inside it, so you can diagnose problems.
- Observability
- Being able to understand what is happening inside a system from the outside.
- Logs
- The text messages a program prints about what it is doing.
- describe
- A kubectl command that shows a resource’s full status and recent events.
- exec
- A command that opens a shell inside a running container to look around.
- CrashLoopBackOff
- A common error meaning a Pod keeps starting and crashing in a loop.
01
kubectl as a stethoscope
describe shows events, logs shows output, exec drops you inside. CrashLoopBackOff and Pending have classic causes worth memorizing.
Try it yourself
bash
$kubectl describe pod web-abc↳Show a pod’s full state, including events and why it failed.$kubectl logs web-abc --previous↳Read logs from the crashed (previous) container instance.$kubectl exec -it web-abc -- sh↳Open a shell inside the running container to poke around.$kubectl get events --sort-by=.lastTimestamp↳List cluster events, newest last, to trace what happened.↳ lines explain what each command does — only the commands get copied
Finished this topic?
Mark it done to earn 100 XP and keep your streak alive.