简体   繁体   English

Kubernetes的异构Pod工作

[英]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): 但是,我可以找到的示例(例如thisthis )都限于同构豆荚(也具有相同的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.

相关问题 Kubernetes - cron 作业未清理 pod - Kubernetes - cron jobs not cleaning up pods Kubernetes是否在内部维护pods / jobs排队? - Does Kubernetes internally maintain pods / jobs queue? 有没有办法查看谁在 Kubernetes 中运行 pods/jobs? - Is there a way to see who ran pods/jobs in Kubernetes? 工作失败后,Kubernetes吊舱消失了 - Kubernetes pods disappear after failed jobs 如何删除已完成的Kubernetes作业中的Pod? - How are pods in completed Kubernetes jobs deleted? Kubernetes使用作业激活数千个Pod的批处理性能 - Kubernetes batch performance with activation of thousands of pods using jobs Kubernetes Cron Jobs - 为一个cron作业运行多个pod - Kubernetes Cron Jobs - Run multiple pods for a cron job 在多个kubernetes pod / instances中处理Redis KUE作业 - Process Redis KUE jobs within multiple kubernetes pods/instances Kubernetes Python客户端-查找挂起的作业并一次安排所有Pod或如何安排挂起的作业 - Kubernetes Python Client - Find pending jobs and schedule all pods at a time or how to schedule a pending job 使用 Kubernetes 执行程序时,将 Gitlab Runner 守护程序的 pod 和作业的 pod 分配给 Kubernetes 中的两个单独的节点组 - Assign Gitlab Runner daemon's pod and the jobs's pods to two separate node groups in Kubernetes when using Kubernetes executor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM