π Kubernetes Pod Debugging π
π Verify the Obvious
βΈ kubectl get pods -o wide β Check if the pod is crashed or pending.
βΈ kubectl describe pod <pod-name> β Inspect restart count, status, and errors.
βΈ kubectl get events --sort-by='.lastTimestamp' β Look for cluster-wide issues.
π Hunt Through Pod Logs
βΉ kubectl logs <pod-name> --previous β Logs from the crashed container.
βΉ kubectl logs <pod-name> -f β Live logs from the current container.
βΉ kubectl logs <pod-name> -c <container-name> β Debug multi-container pods.
β‘ Check Resource Consumption
β kubectl top pods β Identify CPU/Memory spikes.
β kubectl describe node <node-name> β Check for node resource pressure.
β kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[0].resources}{"\n"}{end}' β Verify resource limits.
πΎ Investigate Storage Issues
β kubectl get pvc β Check PersistentVolumeClaim status.
β kubectl describe pvc <pvc-name> β Look for mount failures.
β kubectl get events | grep -i volume β Find storage-related errors.
π Find Network Issues
β kubectl get svc β Verify Service connectivity.
β kubectl describe endpoints <service-name> β Check if pods are registered.
β kubectl get ingress β Debug external access problems.
βοΈ Track Configuration Issues
β kubectl get configmap <cm-name> -o yaml β Detect configuration drift.
β kubectl get secret <secret-name> -o yaml β Ensure secrets exist.
β kubectl describe deployment <deploy-name> β Check for failed rollout strategies.
π Real-Time Debugging
β kubectl exec -it <pod-name> -- /bin/bash β Interactive shell for live debugging.
β kubectl port-forward <pod-name> 8080:80 β Direct local access to the pod.
β kubectl get pods --watch β Real-time monitoring of pod status changes.
