在 3 集群/VM 架构上从 python 查找运行多实例 kubernetes Leader pod 的 IP
我正在开发一个 3 节点(虚拟机)架构,这些架构在同一网络中具有不同的 IP,在每个虚拟机上都运行着一些 kubernetes pod。我想知道 pod 'multi-pod' 的领导者实例正在运行的 IP/节点,它有 2 个实例。
我可以使用以下命令获取领导者:
kubectl exec -it multi-pod --namespace=kube-system -- robotctl leader robot-orch | grep Single
我得到以下提到领导者的o/p:
| multi-pod-kf6pq | multi-pod-kf6pq | Healthy | Singleton | 00 days 10 hours 57 minutes | Leader and only available |
我如何获取运行该实例的IP地址或节点? 节点名称类似于“cluster-1/2/3”。我还尝试将此工作流程转换为 Python 代码。
I am working on a 3 node(VMs) architecture which have different IP all in same network, on each of these VMs some kubernetes pods are running. I want to know the IP/node on which leader instance of pod 'multi-pod' is running it has 2 instances.
I am able to get the leader using below command :
kubectl exec -it multi-pod --namespace=kube-system -- robotctl leader robot-orch | grep Single
I get the below o/p mentioning the leader :
| multi-pod-kf6pq | multi-pod-kf6pq | Healthy | Singleton | 00 days 10 hours 57 minutes | Leader and only available |
How could I get the IP address or node on which this instance is running?
Node names are something like 'cluster-1/2/3'. Also I am trying to translate this workflow into a Python code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论