DevLearn

Kubernetes Troubleshooting

Debugging pods, nodes, networking, events, and common failure patterns

Debug Kubernetes issues: pod troubleshooting, node debugging, network connectivity, storage issues, event analysis, and log examination.

# Pod troubleshooting
kubectl describe pod <pod>
kubectl logs <pod> --previous
kubectl get events --sort-by=.metadata.creationTimestamp

# Debug container
kubectl run debug --rm -it --image=busybox -- sh
kubectl debug pod/<pod> -it --image=ubuntu --share

# Node troubleshooting
kubectl describe node <node>
kubectl get node <node> -o yaml
journalctl -u kubelet

# Network debugging
kubectl run curl --rm -it --image=curlimages/curl -- sh
nslookup kubernetes.default
kubectl exec -it <pod> -- curl -v http://service

# Force delete stuck pod
kubectl delete pod <pod> --force --grace-period=0

# Check certificates
openssl x509 -in /etc/kubernetes/pki/apiserver.crt -text -noout

# View all resources
kubectl get all,cm,secret,pvc -A