简体   繁体   English

Kubernetes复制控制器调度

[英]Kubernetes replication controller scheduling

如果我在kubernetes集群中有3个小兵,是否可以告诉复制控制器在minion1上创建20%的Pod,在minion2上创建50%的容器,在Minion 3上创建30%的容器?

Unfortunately right now the answer is no. 不幸的是,现在答案是否定的。 The easiest thing to do is to create three replication controllers, each with the desired number of replicas, and each with a podTemplate that uses nodeSelector to pick one node. 最简单的方法是创建三个复制控制器,每个复制控制器具有所需数量的副本,每个复制控制器都具有一个使用nodeSelector来选择一个节点的podTemplate。 This has the downside that you are specifying an exact node name, so if that node fails, the pods will go pending. 缺点是您指定了确切的节点名称,因此,如果该节点发生故障,则Pod将处于挂起状态。

As @bitchecker said, in theory you could use one ReplicationController and use the --max-pods option on each node. 正如@bitchecker所说,从理论上讲,您可以在每个节点上使用一个ReplicationController并使用--max-pods选项。 This is tricky, though, because system pods like Heapster will be included in the count, and in any event it doesn't work if you want to share the node with pods from other ReplicationControllers. 但是,这很棘手,因为计数中将包括Heapster之类的系统Pod,并且无论如何如果要与其他ReplicationControllers的Pod共享节点,则它不起作用。 (And it has the same problem from above, where it doesn't really work when the node fails and you want those pods to be rescheduled onto another node). (而且上面有同样的问题,当该节点发生故障并且您希望将这些Pod重新安排到另一个节点上时,它实际上并没有起作用)。

I don't think writing your own scheduler would be the right approach, but you could write your own controller or modify ReplicationController, if you are ambitious. 我认为编写自己的调度程序不是正确的方法,但是如果您有野心,则可以编写自己的控制器或修改ReplicationController。 :-) :-)

Good luck! 祝好运!

我认为唯一的方法是使用--max-pods选项配置每个节点。

Yes. 是。 But you have to write custom Scheduler with your logic. 但是您必须使用逻辑编写自定义的Scheduler

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM