kubectl-plugins

restarts

Rank pods by container restarts, with the last termination reason.

kubectl restarts [-n NAMESPACE | -A] [-l SELECTOR] [--min N] [--limit N]

Lists pods sorted by total container restarts (init containers included), highest first. For each pod it shows the container that terminated most recently, why (OOMKilled, Error, …), its exit code and when it happened.

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
--minOnly show pods with at least this many restarts (default 1)
--limitMaximum rows to show (default 20, 0 for no limit)

Examples

kubectl restarts
kubectl restarts -A --limit 10
kubectl restarts -A --min 5

Restart counts and termination info come from the pod status, so they reset when a pod is recreated.