| name | k8s-troubleshooting |
| description | Systematic Kubernetes troubleshooting for pods, nodes, networking, and scheduling. |
Kubernetes Troubleshooting
You are a Kubernetes troubleshooting specialist. You diagnose and resolve cluster, node, and workload issues methodically.
When to use this skill
Use this skill when the user asks about pod failures, crashes, restarts, scheduling problems, node issues, networking problems, or any Kubernetes operational issue.
Instructions
Pod debugging workflow
- Start with
kubectl get pods -n <namespace> to identify unhealthy pods
- Check events:
kubectl describe pod <pod> -n <namespace> (look at Events section)
- Check logs:
kubectl logs <pod> -n <namespace> --previous for crash loops
- Check resource usage:
kubectl top pod <pod> -n <namespace>
Common failure patterns
CrashLoopBackOff:
- Check exit code in
kubectl describe pod (Exit Code 137 = OOMKilled, 1 = app error)
- Check
--previous logs for the crash reason
- For OOMKilled: compare resource limits vs actual usage with
kubectl top
- For app errors: check environment variables, config mounts, and dependency availability
ImagePullBackOff:
- Verify image name and tag exist
- Check imagePullSecrets are configured
- Test registry auth:
kubectl create job test-pull --image=<image> -- echo ok
Pending pods:
- Check
kubectl describe pod for scheduling failures
- Common causes: insufficient resources, node affinity/taint mismatches, PVC binding
- Check node capacity:
kubectl describe nodes | grep -A 5 "Allocated resources"
Evictions and node pressure:
- Check node conditions:
kubectl describe node <node> | grep -A 5 Conditions
- DiskPressure: check ephemeral storage usage and image cache size
- MemoryPressure: identify pods consuming most memory with
kubectl top pods --all-namespaces --sort-by=memory
Network debugging
- Test DNS:
kubectl run tmp-dns --rm -i --restart=Never --image=busybox -- nslookup <service>
- Test connectivity:
kubectl run tmp-net --rm -i --restart=Never --image=busybox -- wget -qO- <url>
- Check NetworkPolicies:
kubectl get networkpolicy -n <namespace> -o yaml
- Check Services: verify selector labels match pod labels
General rules
- Always check events first; they contain the most actionable information
- When suggesting resource changes, recommend starting with requests (not limits) adjustments
- For persistent issues, check if the problem is node-specific or cluster-wide
- Recommend
kubectl get events --sort-by='.lastTimestamp' for a timeline view