Back to Home

Kubernetes in Production

Troubleshooting

Essential debugging techniques, tools, and troubleshooting methodology for Kubernetes.

Common Issues & Solutions

Pod CrashLoopBackOff

Cause: Application crashes immediately after starting

Solution: Check logs (kubectl logs), verify config, check resource limits, review liveness probe

ImagePullBackOff

Cause: Cannot pull container image

Solution: Verify image name/tag, check registry credentials, ensure network connectivity

Pending Pods

Cause: Cannot schedule pod to any node

Solution: Check node resources, verify node selectors, review taints/tolerations, check PVC binding

Essential kubectl Commands

# Get pod details and events
kubectl describe pod <pod-name>
# View logs (with previous if crashed)
kubectl logs <pod> --previous
# Execute commands in pod
kubectl exec -it <pod> -- /bin/bash
# Check events
kubectl get events --sort-by='.lastTimestamp'

Key Takeaways

  • • Start with kubectl describe and logs
  • • Check events for scheduling issues
  • • Verify resource requests and limits
  • • Use debug containers for investigation