Inspecting and Troubleshooting Your Cluster
Use kubectl to inspect node and pod health, read logs, describe events, and exec into containers so you can diagnose problems in your first cluster.
Inspecting and Troubleshooting Your Cluster is a free DevOps Bootcamp lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
When Things Go Wrong
Your first deploy will sometimes misbehave. The good news: kubectl gives you everything needed to see what is happening and fix it methodically.
Check the Nodes
Start broad. Are the cluster nodes healthy and Ready?
kubectl get nodes -o wideList Pods and Status
Look at pod phases. Running is good; Pending, CrashLoopBackOff, or ImagePullBackOff point to specific problems.
kubectl get pods -o wideDescribe for Details
kubectl describe is your best friend - it shows the spec, current state, and an Events list explaining scheduling and pull failures.
kubectl describe pod my-app-abc123Read the Logs
Application errors usually surface in logs. Stream them with -f, or read a crashed container previous logs with --previous.
kubectl logs -f my-app-abc123Logs from a Crash
If a pod keeps restarting, the current container has no useful logs yet. View the prior instance instead.
kubectl logs my-app-abc123 --previousExec Into a Container
Open a shell inside a running container to inspect files, env vars, and connectivity from the inside.
kubectl exec -it my-app-abc123 -- shCluster-Wide Events
See recent events across the namespace, sorted by time, to spot patterns the per-pod view misses.
kubectl get events --sort-by=.lastTimestampCommon Failure: ImagePullBackOff
This means Kubernetes cannot pull the image - wrong name/tag, private registry without credentials, or a typo. describe shows the exact pull error.
Common Failure: CrashLoopBackOff
The container starts then exits repeatedly. Check logs --previous for the crash reason - often a bad command, missing config, or failed dependency.
Resource and Connectivity Checks
Use kubectl top for live CPU/memory (needs metrics-server) and port-forward to test a service directly from your machine.
kubectl port-forward pod/my-app-abc123 8080:80Quick Check
Diagnose a restarting pod.
Recap
You now have a troubleshooting toolkit:
get nodes/podsfor health,describefor eventslogs(and--previous) for app errorsexecto inspect from inside,port-forwardto test- Recognize
ImagePullBackOffandCrashLoopBackOff
A calm, systematic check of these usually finds the problem fast.
Frequently asked questions
Is the “Inspecting and Troubleshooting Your Cluster” lesson free?
Yes — the full text of “Inspecting and Troubleshooting Your Cluster” is free to read here on the web, and the DevOps Bootcamp course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the DevOps Bootcamp course, upgrade to CoddyKit PRO.
What will I learn in “Inspecting and Troubleshooting Your Cluster”?
Use kubectl to inspect node and pod health, read logs, describe events, and exec into containers so you can diagnose problems in your first cluster. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start DevOps Bootcamp?
No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Inspecting and Troubleshooting Your Cluster” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this DevOps Bootcamp lesson?
Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Minikube Installation & Setup
- Kubeconfig and Contexts
- Deploying a Simple App
- Inspecting and Troubleshooting Your Cluster