79144050

Date: 2024-10-31 09:09:52
Score: 1
Natty:
Report link

this can be done in a one liner:

printf "%-30s %s\n" "NODE_NAME" "POD_ALLOCATION" && kubectl get nodes -o name | xargs -I {} bash -c 'count=$(kubectl get pods --all-namespaces --field-selector spec.nodeName=$(echo {} | cut -d/ -f2) -o json | jq ".items | length"); capacity=$(kubectl get {} -o jsonpath="{.status.capacity.pods}"); printf "%-30s %s/%s\n" "$(echo {} | cut -d/ -f2)" "$count" "$capacity"'
Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: vrabbi