2 min read
A Kubernetes Job is an object that contains a Pod definition, just as a Deployment do, but instead of expecting the Pod to be continuously running, it is expecting it to finish. In case the Pod execution fails, it will continue to retry execution until a specified number of them successfully terminate.
2 min read
If you deploy a Cronjob on Kubernetes it can be useful to test it out by manually triggering a run rather than to wait until it is run according by it's schedule.
Let's assume we have the following Cronjob that we want to run:
$ kubectl get cronjob NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE pet2cattle-sitemapgen 0 5 * * * False 0 <none> 13m
3 min read
The cronjob object haven't been GA until Kubernetes v1.21, even though the Job object have been GA for a long time. Let's take a look how it works:
$ kubectl create job demo --image nginx --dry-run=client -o yaml | head -n1 apiVersion: batch/v1 $ kubectl create cronjob demo --image nginx --schedule="*/1 * * * *" -o yaml --dry-run=client | head -n1 apiVersion: batch/v1beta1