Fast Kubernetes troubleshooting follows evidence, not guesses: identify the failing layer, read current state and events, inspect logs including the previous container, test DNS and Service endpoints, then change one thing and verify.
1. Prepare and execute
Confirm the active kubeconfig context and namespace before applying changes. Save commands and manifests in version control without credentials.
kubectl get nodes
kubectl get pods -A -o wide
kubectl get events -A --sort-by=.lastTimestamp | tail -n 50
kubectl describe pod POD -n NAMESPACE
kubectl logs POD -n NAMESPACE --all-containers --tail=100
kubectl logs POD -n NAMESPACE --previous --tail=100
2. Declarative configuration
Save the following example in a clearly named YAML file, review it, then use server-side dry-run when the API is available.
# Diagnostic order:
# Pending -> scheduler events, requests, affinity, taints, PVCs
# ImagePullBackOff -> image name/tag, registry reachability, imagePullSecrets
# CrashLoopBackOff -> current/previous logs, command, config, probes, OOMKilled
# DNS/Service -> Ready Pods, selector, EndpointSlices, CoreDNS, NetworkPolicy
3. Verify the result
A successful command is not enough. Inspect resource state, conditions, events, endpoints, logs, and an end-to-end request where applicable.
kubectl get pod POD -n NAMESPACE -o jsonpath='{.status.containerStatuses[*].state}'
kubectl get pod POD -n NAMESPACE -o jsonpath='{.status.containerStatuses[*].lastState}'
kubectl get service,endpointslices -n NAMESPACE
kubectl run dns-debug --rm -it --restart=Never --image=busybox:1.37 -- nslookup kubernetes.default
kubectl -n kube-system logs deployment/coredns --tail=100
kubectl top pod -A
4. Troubleshooting
Do not delete a failing Pod until previous logs and events are captured. A controller will usually recreate it with the same failure. Check rollout history, configuration changes, node conditions, quota, limits, and storage before restarting infrastructure.
5. Rollback and cleanup
Review the exact target before deleting resources, especially namespaces, claims, Secrets, and cluster-wide add-ons.
kubectl rollout undo deployment/APP -n NAMESPACE
kubectl rollout status deployment/APP -n NAMESPACE
# Use only after evidence collection:
kubectl delete pod POD -n NAMESPACE
Production checklist
- The active context, namespace, and target version were verified.
- Manifests passed client or server-side validation.
- Resource conditions and recent events show no unresolved error.
- Access, network exposure, resource limits, persistence, and rollback were reviewed.
- Commands and expected output were recorded for the operating team.
References: topic documentation and Kubernetes documentation.