I've read these docs over multiple times but still don't think I understand what startingDeadlineSeconds
does.
I'm trying to figure out if it's possible to avoid rescheduling a job if a current one is running (with CronJob
) and instead just let the next scheduled job pick up where it left off.
I have some extremely erratic job completion times (a separate problem I need to solve). It may take 1 hour or up to 24. So sometimes, if a Job takes a whole day to complete, but I've scheduled it to run every 12 hours, I get a queue of another job that immediately starts when the last one is complete.
I'd really just like it to never queue up a job and only create new jobs on the next scheduled time.
Here's a sample of the config
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: my-job
spec:
schedule: "0 */2 * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 1
jobTemplate:
spec:
backoffLimit: 1
template:
spec:
containers:
- name: my-job
image: my-image
command: ["do_something"]
restartPolicy: OnFailure
Note that do_somethign
could take 1 hour, or it could take 4 hours. What I'd like, is when it takes 4 hours, to not have queued up the 2nd job that would have normally run if it had taken less.
Is this possible with Kubernetes CronJob?
0 Answers