是否有可能从kubectl获取在matser上运行的pod列表?
我试过这个
kubectl get pods -o wide --sort-by="{.spec.nodeName}"
但这并没有说节点是主节点还是工作节点
最佳答案 如
the overview中所述:
A Pod always runs on a 07001.
A Node is a worker machine in Kubernetes and may be either a virtual or a physical machine, depending on the cluster. Each Node is managed by the Master
因此,根据定义(即使它在与主服务器相同的物理机器上运行),任何节点都在“工作机器”上
只有kubectl get节点才会显示ROLE:
vonc@voncvb:~/.kube$kubectl get node -o wide
NAME STATUS ROLES AGE VERSION EXTERNAL-IP OS-IMAGE KERNEL-VERSION
serv0.server Ready <none> 18d v1.9.7 <none> SUSE CaaS Platform 3.0 docker://x.y.z.z
serv1.server Ready <none> 18d v1.9.7 <none> SUSE CaaS Platform 3.0 docker://x.y.z.z
serv2.server Ready <none> 18d v1.9.7 <none> SUSE CaaS Platform 3.0 docker://x.y.z.z
servm.server Ready master 18d v1.9.7 <none> SUSE CaaS Platform 3.0 docker://x.y.z.z
^^^^^^^