kubernetes-Jobs
A Job creates one or more Pods and ensures that a specified number of them successfully terminate. As pods successfully complete, the Job tracks the successful completions. When a specified number of successful completions is reached, the task (ie, Job) is complete. Deleting a Job will clean up the Pods it created.
A simple case is to create one Job object in order to reliably run one Pod to completion. The Job object will start a new Pod if the first Pod fails or is deleted (for example due to a node hardware failure or a node reboot).
You can also use a Job to run multiple Pods in parallel.
LAB
1. Job manifest file:
2. Create & Display
kubectl create -f countdown-jobs.yaml
kubectl get jobs
kubectl get po
kubectl describe jobs countdown
*************************************************************************************************************************************************
3. Test
kubectl logs [POD_NAME]
*************************************************************************************************************************************************
4. Cleanup
kubectl delete jobs countdown
kubectl get po
**************Cron Job***********************
kubectl create -f cronjob.yaml
kubectl patch cronjob cronjob -p '{"spec":{"suspend":true}}'
concurrencyPolicy: Allow,Forbid,Replace
Allow to allow multiple jobs runs at a time
Forbid to wait a running job to finish first and then execute another instance of the job
Replace to replace an existing job.
Comments
Post a Comment