关于kubectl:Kubernetes-如何知道哪个小兵正在托管Pod

Kubernetes - How to know which minions are hosting Pods

我有一个6个仆从集群,并且想知道在任何给定时间实际上有多少个仆从在托管豆荚。有特定的命令吗?现在,我正在使用非常通用的命令。

1
2
kubectl get po | grep Running > RUNNING.txt
for i in `cat RUNNING.txt `; do kubectl describe po $i; done | grep"Started container with docker

"

是否有任何直接命令来获取我想要的信息?


只需添加-o wide

1
kubectl get pod -o wide


此命令将打印在其上运行了pod的所有节点:

1
2
kubectl get pods -o jsonpath='{range .items[*]}{.spec.nodeName} {end}' | tr"""\
" | sort | uniq