Skip to content

Instantly share code, notes, and snippets.

@rms1000watt
Created February 26, 2020 22:07
Show Gist options
  • Save rms1000watt/f25c1c77ac76143d51ef5a0cad4961af to your computer and use it in GitHub Desktop.
Save rms1000watt/f25c1c77ac76143d51ef5a0cad4961af to your computer and use it in GitHub Desktop.
Kubernetes Print all Pods per Node
#!/usr/bin/env bash
rm k8s-nodes-pods.txt &> /dev/null
for node in $(kubectl get nodes | grep -v NAME | cut -d' ' -f1); do
kubectl describe node "${node}" | grep -A99999 Namespace | grep -B999999 "Allocated resources:" | grep -v Allocated | grep -v Namespace | grep -v "\-\-\-\-\-" | awk '{print "'"${node}"' " $0}' >> k8s-nodes-pods.txt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment