When we create a job spec, we can give --activeDeadlineSeconds flag to the command.
This flag relates to the duration of the job, once the job reaches the threshold specified by the flag, the job will be terminated.
kind: CronJob
apiVersion: batch/v1beta1
metadata:
name: mycronjob
spec:
schedule: "*/1 * * * *"
activeDeadlineSeconds: 200
jobTemplate:
metadata:
name: google-check-job
spec:
template:
metadata:
name: mypod
spec:
restartPolicy: OnFailure
containers:
- name: mycontainer
image: alpine
command: ["/bin/sh"]
args: ["-c", "ping -w 1 google.com"]