[英]Kubernetes jobs with heterogeneous pods
I want to deploy a distributed system with one master and N followers. 我想部署一个具有一个主服务器和N个从属的分布式系统。 All the followers run the same image but with different arguments. 所有关注者都运行相同的图像,但参数不同。 Since they all terminate after a successful run, Jobs
seems to be a good fit. 由于它们都在成功运行后终止,因此Jobs
似乎很合适。
However, the examples I can find, eg, this and this , are all limited to homogeneous pods (also with the same args): 但是,我可以找到的示例(例如this和this )都限于同构豆荚(也具有相同的args):
apiVersion: batch/v1
kind: Job
metadata:
name: primes
spec:
template:
metadata:
name: primes
spec:
containers:
- name: primes
image: ubuntu
command: ["bash"]
args: ["-c", "current=0; max=70; echo 1; echo 2; for((i=3;i<=max;)); do for((j=i-1;j>=2;)); do if [ `expr $i % $j` -ne 0 ] ; then current=1; else current=0; break; fi; j=`expr $j - 1`; done; if [ $current -eq 1 ] ; then echo $i; fi; i=`expr $i + 1`; done"]
restartPolicy: Never
I'm new to Kubernetes. 我是Kubernetes的新手。 Is what I need possible with Jobs? 乔布斯有什么可能吗? Can somebody point me to some examples for heterogeneous pods? 有人可以指出一些有关异构吊舱的例子吗?
There is support for a single job with multiple types of pods. 支持具有多种类型的吊舱的单个作业。 You would want to make either two different jobs or a single job where the scripting inside the container detects on its own if it should be a leader or follower. 您可能想要做两个不同的工作,或者想做一个单独的工作,容器中的脚本自行检测是应该作为领导者还是跟随者。 If the leader/follower config is part of the command-line arguments, the former is probably easier. 如果leader / follower配置是命令行参数的一部分,则前者可能更容易。 Make one job, wait for it to start, get the hostname of the pod, then start the followers job with that hostname in the podspec. 做一份工作,等待它启动,获取pod的主机名,然后使用podspec中的该主机名启动关注者作业。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.