Last active
November 9, 2020 19:24
-
-
Save rms1000watt/5813ce7a4b1516d917e2b90d847c3077 to your computer and use it in GitHub Desktop.
k8s cluster memory % for 16GB RAM VMs
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
| VM_MEM=16 | |
| VM_NODES=$(kubectl top node --sort-by memory | grep -iv memory | wc -l) | |
| K8S_MEM=$(kubectl top node --sort-by memory | awk '{print $5}' | tr -d '%' | grep -iv memory | paste -s -d+ - | bc) | |
| echo "Cluster Memory: $(($VM_NODES*$VM_MEM*100/$K8S_MEM))%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment