Menu

kubectl Troubleshooting & Daily Commands Cheat Sheet
📰

kubectl Troubleshooting & Daily Commands Cheat Sheet

DEV Community: kubernetes·Vlad-Raul Guran·about 5 hours ago
#ZlLgLNtw
#devtokubernetes#devto#dev#kubectl#status
Reading 0:00
15s threshold

Production-grade triage, debugging, and recovery with kubectl, targeting kubectl / Kubernetes v1.31+ .

Quick Reference

Task Command

Wide pod status kubectl get pods -o wide -n <ns>

Full object state and events kubectl describe pod <pod>

Recent warnings kubectl events -n <ns> --types=Warning

Logs from the crashed container kubectl logs <pod> -c <ctr> --previous

Tail logs across a label kubectl logs -l app=web --prefix --since=15m -f

Shell into a container kubectl exec -it <pod> -c <ctr> -- sh

Ephemeral debug container kubectl debug -it <pod> --image=busybox:1.36 --target=<ctr>

Node shell kubectl debug node/<node> -it --image=busybox:1.36

Resource usage kubectl top pod -n <ns> --sort-by=memory

Rollout progress kubectl rollout status deploy/<name> --timeout=5m

Roll back kubectl rollout undo deploy/<name>

Local tunnel kubectl port-forward svc/<svc> 8080:80

RBAC check kubectl auth can-i <verb> <resource> --as=<user>

Preview changes kubectl diff -f <file>.yaml

Wait for readiness kubectl wait…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.