Skip to content

Instantly share code, notes, and snippets.

@ernoaapa
Last active March 26, 2024 14:07
Show Gist options
  • Save ernoaapa/c8ef4973aa30104cfc898ec94b7e3f29 to your computer and use it in GitHub Desktop.
Save ernoaapa/c8ef4973aa30104cfc898ec94b7e3f29 to your computer and use it in GitHub Desktop.
Script to list all Kubernetes Pods what are NOT ready
#!/bin/sh
#
# Print Pods which are Pending or not Ready for some reaosn
#
kubectl get pods --all-namespaces -o go-template='{{ range $item := .items }}{{ range .status.conditions }}{{ if (or (and (eq .type "PodScheduled") (eq .status "False")) (and (eq .type "Ready") (eq .status "False"))) }}{{ $item.metadata.name}} {{ end }}{{ end }}{{ end }}'
@Davidsod
Copy link

Davidsod commented Nov 4, 2021

This one would also catch completed pods (jobs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment