Job are much like Pods, but differ since they terminate once the task is completed. The Job feature ensures the job complete successfully and can optionally rerun the tasks until a success is reported.
Job efficiently run in parallel. Where once you may have been inclined to multi-thread the application in the container, you can instead keep the container a simple task runner and rely on Kubernetes resource management and Job parallelism to a achieve threading with a more effect pattern.
When combined with a queuing or messaging mechanism, Jobs can asynchronously process any tasks you decide to design.
To further this thinking consider investigating serverless or function implementations on Kubernetes. In many ways Jobs are a primitive form of what various serverless solution achieve as functions. Take a look at Knative based solutions to understand how you may someday want to evolve your Jobs into Functions.
With these steps you have learned:
- ✔ how Jobs are defined and work in Kubernetes,
- ✔ how Kubernetes resilience recovers failed jobs,
- ✔ how Job can serially or in parallel,
- ✔ why it's more efficient to run Jobs in parallel,
- ✔ how Jobs can process a work queue.
For a deeper understanding of these topics and more join me, Jonathan Johnson, for a transcendent experience on the No Fluff Just Stuff Software Symposium Tour.