K8S--JOB 配置模板
实现运行pod数6台 。并行运行2台。总运行时间360sapiVersion: batch/v1kind: Jobmetadata:name: test-jobspec:completions: 6# 需要运行的pod数量parallelism: 2# 允许并发运行的pod数量activeDeadlineSeconds: 360# pod运行的超时时间template:metadata:label
·
实现运行pod数6台 。并行运行2台。总运行时间360s
apiVersion: batch/v1
kind: Job
metadata:
name: test-job
spec:
completions: 6 # 需要运行的pod数量
parallelism: 2 # 允许并发运行的pod数量
activeDeadlineSeconds: 360 # pod运行的超时时间
template:
metadata:
labels:
app: test-job
spec:
containers:
- name: test-job
image: luksa/batch-job
imagePullPolicy: IfNotPresent
restartPolicy: OnFailure
固定结束次数的 Job 示例
apiVersion: batch/v1
kind: Job
metadata:
name: busybox
spec:
completions: 3
template:
metadata:
name: busybox
spec:
containers:
- name: busybox
image: busybox
command: ["echo", "hello"]
restartPolicy: Never
结果
[root@k8s-master job]# kubectl get pods
NAME READY STATUS RESTARTS AGE
busybox-4cjq7 0/1 Completed 0 40s
busybox-79x79 0/1 Completed 0 22s
busybox-frk5t 0/1 Completed 0 52s
更多推荐
已为社区贡献2条内容
所有评论(0)