DevOps / Scripts bash Advanced

Kubernetes CrashLoop Detector

Scan all namespaces for pods stuck in CrashLoopBackOff and output a TSV report.

bash
#!/bin/bash
kubectl get pods --all-namespaces -o json | jq -r '.items[] | select(.status.containerStatuses[]?.state.waiting.reason == "CrashLoopBackOff") | [.metadata.namespace, .metadata.name] | @tsv' | column -t

Prerequisites

  • kubectl
  • jq

Pro Tips

  • → Wrap in a K8s CronJob for scheduled alerts.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
bash
Level
Advanced
Read time
4 min
Published
Mar 2024
License
Commercial License

Newsletter

New modules every week, directly to your inbox.