Created
August 2, 2017 20:24
-
-
Save carimura/8aa6bd3f5ac21866f185e216bc19857a to your computer and use it in GitHub Desktop.
kubernetes: get all pods grouped by nodes
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
kubectl get pods --all-namespaces -o json | jq '.items | map({podName: .metadata.name, nodeName: .spec.nodeName}) | group_by(.nodeName) | map({nodeName: .[0].nodeName, pods: map(.podName)})' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output looks like: