Last active
May 7, 2020 10:43
-
-
Save omerh/4578cadba4a2548d7ed7b7d86e673d9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
nodes=$(kubectl get nodes --no-headers |awk '{print $1}') | |
for n in $nodes; do | |
pods=$(kubectl describe node $n | grep -A100 Namespace | grep -B100 'Allocated resources' | tail -n +3 | grep -v 'Allocated' | grep -v 'monitoring\|logging\|kube-' | wc -l) | |
if [[ $pods -lt 1 ]]; then | |
echo "Node $n has $pods running" | |
#else | |
# echo "Node $n has $pods running" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment