Want to list the number of ready nodes without any taint. I get the list of nodes using below query:
kubectl get nodes -o json|jq -jr '{.items[]|select(.spec.taints|not)|select(.status.conditions[].type=="Ready" and .status.conditions[].status="True")|.metadata.name+"\n"}'
This gives me below output
node01
node01
How to I get number of nodes instead of actual node names from this query ?
Use this for number of nodes with "No taint":
kubectl get nodes -o json | jq '.items[] | select(.spec.taints|not) | .metadata.name' | wc -l
Get number of nodes with "Ready" status and "No taint":
kubectl get nodes -o json|jq -r '.items[]|select(.status.conditions[].type=="Ready")|select(.spec.taints|not).metadata.name' | wc -l