kubectl-plugins

unhealthy

List pods that are not Ready, crash-looping, pending or failed, with the reason.

Install kubectl-unhealthy
curl -fsSL https://kubectl-plugins.dev/install.sh | sh -s -- unhealthy
Download a binary insteadmacOS (Apple silicon) · macOS (Intel) · Linux (amd64) · Linux (arm64) · Windows (amd64)
Put the binary on your PATH as kubectl-unhealthy, or build from source.
kubectl unhealthy [-n NAMESPACE | -A] [-l SELECTOR]

Scans pods and prints only the ones that need attention. Completed pods (Succeeded) and fully Ready pods are skipped.

What counts as unhealthy

StatusMeaning
CrashLoopBackOff, ImagePullBackOff, …A container is waiting with that reason (init containers included)
Error, OOMKilled, …A container terminated with a non-zero exit code
FailedThe pod phase is Failed
PendingNot scheduled or not started, with the scheduler’s reason when available
TerminatingThe pod has a deletion timestamp
NotReadyRunning, but not all containers are Ready

Flags

FlagDescription
-n, --namespaceNamespace to scan (default: current context namespace)
-A, --all-namespacesScan every namespace and add a NAMESPACE column
-l, --selectorOnly scan pods matching a label selector

Examples

kubectl unhealthy
kubectl unhealthy -A
kubectl unhealthy -l app=web

Sample output

$ kubectl unhealthy -A
NAMESPACE   NAME                    READY  STATUS            REASON
default     api-7d9c8b6f5-x2k4p     0/1    CrashLoopBackOff  container api: back-off 5m0s restarting failed container
default     web-5c6d7f9b8-q9w7z     0/1    ImagePullBackOff  container web: Back-off pulling image "web:v9"
jobs        report-28391           0/1    OOMKilled         container report exited with code 137
staging     worker-6f4b5c7d9-m3n8b  1/2    NotReady          containers with unready status: [sidecar]

Prints All pods healthy. when nothing is wrong.

Tips