cronjob简单使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
kind: CronJob
apiVersion: batch/v1beta1
metadata:
name: hello
spec:
schedule: '* * * * *'
successfulJobsHistoryLimit: 3 #指定应保留多少已完成作业
failedJobsHistoryLimit: 1 #指定应保留多少失败作业
concurrencyPolicy: Allow
suspend: false
jobTemplate:
metadata:
creationTimestamp: null
spec:
template:
metadata:
creationTimestamp: null
spec:
containers:
- name: hello
image: busybox
args:
- /bin/sh
- '-c'
- date; echo Hello from the Kubernetes cluster
resources: {}
imagePullPolicy: Always
restartPolicy: OnFailure
terminationGracePeriodSeconds: 30