标签:ons busybox 启动 code star containe 任务 并发 restart
concurrencyPolicy 可以设置并发策略,合法的值包括以下三种,默认为 Allow:
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: busybox
spec:
jobTemplate:
spec:
template:
spec:
containers:
- name: busybox
image: busybox:1.30.0
command: ["/bin/sh", "-c", "sleep 150;date"]
restartPolicy: Never
schedule: "* * * * *"
[root@master ~]# kubectl get cj,job,pod
NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE
cronjob.batch/busybox * * * * * False 2 30s 112s
NAME COMPLETIONS DURATION AGE
job.batch/busybox-1617723360 0/1 81s 81s
job.batch/busybox-1617723420 0/1 21s 21s
NAME READY STATUS RESTARTS AGE
pod/busybox-1617723360-wplhx 1/1 Running 0 81s
pod/busybox-1617723420-7jts2 1/1 Running 0 21s
可以看到两个任务在同时运行。
concurrencyPolicy 字段可以设置并行运行的策略。
标签:ons busybox 启动 code star containe 任务 并发 restart
原文地址:https://www.cnblogs.com/jiangbo44/p/14723975.html