Last active
February 8, 2019 18:24
-
-
Save davidxia/550fa301258daacd00730f55bf324c65 to your computer and use it in GitHub Desktop.
kubectl tricks
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
# total memory usage (Mi mebibytes 1,048,576 bytes) of all pods in a namespace | |
kubectl -n $namespace top pod | \ | |
tail -n +2 | \ | |
awk '{print $3}' | \ | |
tr -d 'Mi' | \ | |
awk '{s+=$1} END {print s}' | |
# total CPU usage (millicores) of all pods in a namespace | |
kubectl -n $namespace top pod | \ | |
tail -n +2 | \ | |
awk '{print $2}' | \ | |
tr -d 'm' | \ | |
awk '{s+=$1} END {print s}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment