I have a 6 minion cluster and would like to know how many of these minions are actually hosting pods at any given time. Is there a specific command for that ? Right now Im using a very generic command.
kubectl get po | grep Running > RUNNING.txt
for i in `cat RUNNING.txt `; do kubectl describe po $i; done | grep "Started container with docker
"
Any direct command to fetch the info I want ?
This command will print all the nodes that have pods running on them:
kubectl get pods -o jsonpath='{range .items[*]}{.spec.nodeName} {end}' | tr " " "\n" | sort | uniq
Just add -o wide
:
kubectl get pod -o wide