作者:顺大顺麻麻1009_388 | 来源:互联网 | 2023-09-24 17:12
创建 CronJob
cronjob.yaml
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: hello
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: busybox
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- date; echo Hello from the Kubernetes cluster
restartPolicy: OnFailure
kubectl create -f cronjob.yaml
实测发现:
它会生成:Jobs 和 Pods 去执行里面的命令: