Skip to content

Instantly share code, notes, and snippets.

@efossas
Created July 11, 2022 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save efossas/4741758815cfd3f00dec11b55b1a40a8 to your computer and use it in GitHub Desktop.
Save efossas/4741758815cfd3f00dec11b55b1a40a8 to your computer and use it in GitHub Desktop.
View Node Capacity
# capacity
capacity() {
echo "node cpu.capacity cpu.allocatable memory.capacity memory.allocatable" | awk '{printf "%-50s %-20s %-20s %-20s %-20s \n", $1, $2, $3, $4, $5}';
kubectl get nodes -o json | jq -r '.items[] | "\(.metadata.name) \(.status.capacity.cpu) \(.status.allocatable.cpu) \(.status.capacity.memory) \(.status.allocatable.memory)"' | awk '{printf "%-50s %-20s %-20s %-20s %-20s \n", $1, $2, $3, $4, $5}';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment