Skip to content

Instantly share code, notes, and snippets.

@sokoow
Created October 17, 2018 09:52
Show Gist options
  • Select an option

  • Save sokoow/f8f4dc84ca1eebacdd5f576e385e660b to your computer and use it in GitHub Desktop.

Select an option

Save sokoow/f8f4dc84ca1eebacdd5f576e385e660b to your computer and use it in GitHub Desktop.
List JSON info about Kubernetes nodes
#!/bin/bash
node_num=$(kubectl get no -o json | tee nodes.json | jq ".items" | grep metadata | wc -l) && for i in $(seq 0 $(echo "$node_num - 1" | bc)); do cat nodes.json | jq ".items[$i].status.nodeInfo" && cat nodes.json | jq ".items[$i].status.allocatable"; done && rm nodes.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment