Created
December 28, 2023 18:35
-
-
Save riskiwah/55dca6297ea1efbff9aaaeea85d50385 to your computer and use it in GitHub Desktop.
quick cronjob kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: batch/v1 | |
kind: CronJob | |
metadata: | |
name: error-demo-cronjob | |
spec: | |
schedule: "*/5 * * * *" | |
successfulJobsHistoryLimit: 2 | |
failedJobsHistoryLimit: 1 | |
jobTemplate: | |
spec: | |
template: | |
spec: | |
containers: | |
- name: error-demo-container | |
image: busybox | |
command: ["false"] # This command always returns an error status | |
restartPolicy: OnFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: batch/v1 | |
kind: CronJob | |
metadata: | |
name: success-demo-cronjob | |
spec: | |
schedule: "*/1 * * * *" | |
successfulJobsHistoryLimit: 2 | |
failedJobsHistoryLimit: 2 | |
jobTemplate: | |
spec: | |
template: | |
spec: | |
containers: | |
- name: success-demo-container | |
image: busybox | |
command: ["/bin/sh", "-c"] | |
args: | |
- "sleep 5 && echo Hello" | |
restartPolicy: OnFailure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment