Kubectl Troubleshooting
A systematic drill for CrashLoopBackOff and friends.
- crashloopbackoff
- imagepullbackoff
- kubectl debug
- troubleshoot pods
- k8s events
Kubectl Troubleshooting
A systematic drill for CrashLoopBackOff and friends.
Commands
| Command | What it does | |
|---|---|---|
| `kubectl get pods -A | grep -v Running` | Find unhealthy pods fast |
kubectl describe pod <p> | Events tell the story bottom-up | |
kubectl logs <p> --previous | Logs of the crashed attempt | |
| `kubectl get events --sort-by=.lastTimestamp | tail -30` | Cluster-wide recent warnings |
kubectl debug <p> -it --image=busybox --target=<c> | Ephemeral debug container |
Example
kubectl get pods -n shop | grep -v Running
kubectl describe pod api-xyz -n shop
kubectl logs api-xyz -n shop --previous | tail -50
FAQ
CrashLoopBackOff — first three steps?
describe (events), logs --previous (crash output), then verify image, env, and probes — in that order.
ImagePullBackOff — causes?
Wrong tag, private registry without imagePullSecrets, or rate limits; describe shows the exact registry error.
FAQ
CrashLoopBackOff — first three steps?
describe (events), logs --previous (crash output), then verify image, env, and probes — in that order.
ImagePullBackOff — causes?
Wrong tag, private registry without imagePullSecrets, or rate limits; describe shows the exact registry error.
Kubernetes
Kubectl Config and Context
Point kubectl at the right cluster and switch contexts safely.
Kubectl Pods
Inspect pods, describe failures, and get a shell inside.
Kubectl Deployments
Create, update, and inspect Deployments that own your pods.
Kubectl Services
Expose pods stably with ClusterIP, NodePort, and LoadBalancer.