Structured Troubleshooting for Production Kubernetes
A field-tested approach to diagnosing and resolving Kubernetes issues with actionable steps and prevention strategies.
A field-tested approach to diagnosing and resolving Kubernetes issues with actionable steps and prevention strategies.
Workflow: Observe → Diagnose → Repair → Prevent
-
Observe
- Monitor alerts, logs, and metrics (Prometheus, Grafana, EFK stack).
- Validate user reports: “App X is slow” → check latency percentiles, error rates.
- Use
kubectl get pods --all-namespacesandkubectl describe pod <troubled-pod>to surface anomalies.
-
Diagnose
- Node-level: Check node status (
kubectl get nodes), resource pressure (kubectl top node), and system logs (journalctl -u kubelet). - Pod-level: Inspect events (
kubectl describe pod), container logs (kubectl logs <pod> --container=<container>), and readiness/liveness probes. - Network: Test connectivity with
kubectl exec -it <pod> -- curl <service>, validate network policies (kubectl get networkpolicies).
- Node-level: Check node status (
-
Repair
- Rollback deployments:
kubectl rollout undo deployment/<deployment>. - Drain nodes for maintenance:
kubectl drain <node> --ignore-daemonsets --delete-emptydir-data. - Force pod evictions if stuck:
kubectl delete pod <pod> --force.
- Rollback deployments:
-
Prevent
- Implement resource limits and requests to avoid OOM kills.
- Use admission controllers (e.g.,
NamespaceLifecycle,ResourceQuota) to enforce policies. - Conduct blameless postmortems to update playbooks.
Policy Example: Maintenance Window Enforcement
Policy: All node maintenance requiring downtime must occur during scheduled windows (e.g., 02:00–04:00 UTC).
Implementation:
- Use
kubectl taintto enforce node exclusions:kubectl taint nodes <node-name> node.maintenance/no-schedule:NoSchedule - Automate alerts via Prometheus for unscheduled drain attempts.
Tradeoff: Reduced flexibility for urgent fixes but minimizes user impact during peak hours.
Tooling
- CLI:
kubectl,k9s(for quick navigation),oc(OpenShift users). - Monitoring: Prometheus + Grafana for dashboards, Alertmanager for notifications.
- Logging: EFK (Elasticsearch, Fluentd, Kibana) or Loki + Promtail.
- Debugging:
kubectl exec,kubectl port-forward, and sidecar debug containers.
Caveat: Over-instrumentation can create noise. Start with core metrics (CPU, memory, network I/O) before adding custom ones.
Troubleshooting Common Failures
-
Node Not Ready
- Check kubelet status:
systemctl status kubelet(on-node). - Verify cloud provider status (e.g., AWS IMDSv1 vs. v2 issues).
- Check kubelet status:
-
Pod CrashLoopBackOff
- Run
kubectl describe podto identify image pull errors or misconfigured volumes. - Inspect container logs:
kubectl logs <pod> --previous.
- Run
-
NetworkPolicy Blocking Traffic
- Test with
kubectl exec -it <pod> -- curl <target-service-ip>. - Validate policy rules:
kubectl get networkpolicy <policy-name> -o yaml.
- Test with
-
Persistent Volume Issues
- Check PV/PVC binding status:
kubectl get pvc --all-namespaces. - Use
kubectl describe pvc <pvc-name>to spot provisioning errors.
- Check PV/PVC binding status:
Final Note
Troubleshooting is 20% tools and 80% process. Document playbooks for recurring issues, automate where possible, and prioritize observability over guesswork. Always validate fixes with kubectl get events --sort-by=.metadata.creationTimestamp to ensure stability.
Source thread: Curious about what people usually follow during the troubleshooting process?

Share this post
Twitter
Google+
Facebook
Reddit
LinkedIn
StumbleUpon
Pinterest
Email