如何在互斥节点中运行两个Pod? [英] How to run two pods in exclusive nodes?

查看:200
本文介绍了如何在互斥节点中运行两个Pod?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在互斥节点中运行两个Pod.例如,我有4个节点(node-1,node-2,node-3,node-4)和2个pod(pod-1,pod-2).我只希望在每个节点中都可以运行一个Pod,并且要在两个节点中都可以运行每个Pod,例如节点1和节点2中的pod-1,节点3和节点4中的pod-2.有没有办法配置这种方式?

I'd like to run two pods in exclusive nodes. For instance, I have 4 nodes (node-1, node-2, node-3, node-4) and 2 pods (pod-1, pod-2). I want only one pod to run in each node and each pod to run in two nodes, e.g. pod-1 in node-1 and node-2, pod-2 in node-3 and node-4. Is there a way to configure this way?

推荐答案

您可以通过创建无法在同一台计算机上调度的容器定义来强制排他性.最简单的方法是为每个Pod分配相同的主机端口.为两个Pod定义都设置了相同的主机端口后,如果创建两个复制控制器,每个复制控制器都具有两个副本,则调度程序将运行2个Pod的2个副本,这些副本分布在4台计算机上.

You can force exclusivity by creating pod definitions that are unable to schedule on the same machine. The easiest way to do that is to assign each pod the same host port. Once you have the same host port set for both of your pod definitions, if you create two replication controllers with two replicas each, then the scheduler will run 2 copies of 2 pods spread across 4 machines.

这篇关于如何在互斥节点中运行两个Pod?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆