Created
July 5, 2022 04:04
-
-
Save efossas/2bdbb74d07edbbec57939a6f1e61b3a2 to your computer and use it in GitHub Desktop.
Sort Kubernetes Pod CPU & Memory Usage
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
# system [cpu|mem] | |
system() { | |
if [[ "$1" == "cpu" ]]; then | |
kubectl top pod --all-namespaces | tail -n +2 | sort --reverse --key 3 --numeric; | |
elif [[ "$1" == "mem" ]]; then | |
kubectl top pod --all-namespaces | tail -n +2 | sort --reverse --key 4 --numeric; | |
else | |
echo "unknown resource type"; | |
fi; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment