Created
August 28, 2020 13:13
-
-
Save ruzickap/38371f3a7d590907870dfe314ad9bb60 to your computer and use it in GitHub Desktop.
Show number of containers running on all the worker nodes in Kubernetes
This file contains hidden or 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
GET_NODES=$(kubectl get node -o=custom-columns='NAME:metadata.name' | grep -v ^NAME) | |
for NODE in ${GET_NODES}; do | |
echo -en "${NODE}:\t" | |
kubectl get po --field-selector=status.phase=Running --all-namespaces -o json | jq -r ".items[] | select(.spec.nodeName==\"${NODE}\") | .metadata.name" | wc -l | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment