Kubernetes API-在特定节点上获取Pods [英] Kubernetes API - gets Pods on specific nodes
问题描述
查看 http://kubernetes.io/docs /user-guide/labels/#selecting-sets-of-nodes ,似乎可以根据标签选择一定范围的广告连播.但就我而言,我想选择一个节点上的所有Pod,但不想在其相应节点上标记每个Pod.
Looking at http://kubernetes.io/docs/user-guide/labels/#selecting-sets-of-nodes it looks to be possible to select a certain range of pods based on labels. But in my case I want to select all the pods on one node but I don't want to label each pod on their corresponding node.
我是否缺少文档中的内容?或者是否无法按节点进行选择? 如果我这样做:
Am I missing something from the documentation or is it just not possible to select by node? If I do:
kubectl --server="<SERVER>" --namespace=<NS> get pods -o wide | head
NAME READY STATUS RESTARTS AGE NODE
这些标头中的任何一个都可以用作选择器吗?如果是的话,最重要的是如何使用kubectl破产,如何使用API?
Can any of these header be used as selector? If yes how to do it with kubectl bust most importantly, how to do it with the API?
预先感谢
推荐答案
如已接受的答案中所述,PR现在已合并,您可以按如下所示按节点获取吊舱:
As mentioned in the accepted answer the PR is now merged and you can get pods by node as follows:
kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<node>
这篇关于Kubernetes API-在特定节点上获取Pods的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!