Skip to content

Instantly share code, notes, and snippets.

@visualdensity
Last active May 28, 2019 23:31
Show Gist options
  • Save visualdensity/ad187dafa44976d0344d350116a27693 to your computer and use it in GitHub Desktop.
Save visualdensity/ad187dafa44976d0344d350116a27693 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eo pipefail
pools=("core" "batch" "system")
poolPrefix="worker-pool-"
for i in "${pools[@]}"
do
poolName="${poolPrefix}${i}"
echo "### $poolName ###"
output=`kubectl --context=active-prod get nodes --selector="kops.k8s.io/instancegroup=$poolName"`
echo "$output"
count=`echo "$output" | grep -v NAME | wc -l | sed -e 's/^[[:space:]]*//'`
echo "Total: $count nodes"
echo ""
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment