3 min read
If we take a look all the possible properties for a Pod definition we might notice that there's one to limit the time a Pod can be running:
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
activeDeadlineSeconds: 10
containers:
- args:
- sleep
- 24h
image: alpine
name: test
07/03/2022
Read more...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.
05/08/2021
Read more...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
21/01/2021
Read more...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
20/01/2021
Read more...