[英]How can I get the node where the pod is located using kubernetes python client?
I have a Pod name and I want to know where the Pod is located using kube.netes python client.我有一个 Pod 名称,我想使用 kube.netes python 客户端知道 Pod 的位置。 Is it possible to use kube.netes python client in order to get the node name by Pod?是否可以使用 kube.netes python 客户端来通过 Pod 获取节点名称? (Just like the NODE column in kubectl get pod -o wide
) (就像kubectl get pod -o wide
中的 NODE 列一样)
I've referred to the document https://github.com/kube.netes-client/python/blob/master/kube.netes/README.md .我参考了文档https://github.com/kube.netes-client/python/blob/master/kube.netes/README.md 。 But I didn't find a solution.但是我没有找到解决办法。
I think read_namespaced_pod
has the information ( spec.nodeName
).我认为read_namespaced_pod
有信息( spec.nodeName
)。
https://github.com/kube.netes-client/python/blob/master/kube.netes/docs/CoreV1Api.md#read_namespaced_pod https://github.com/kube.netes-client/python/blob/master/kube.netes/docs/CoreV1Api.md#read_namespaced_pod
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.