All the pods that we have run so far are intended to keep running indefinitely. That is, until we decide to kill them, they should keep running forever. That is not always what we want, though. Sometimes we need to run a process that performs a specific task and exits. A database migration is a good example where we want it to start, do what it needs to do, and exit. It doesn’t need to keep running forever. For these cases, we can use the Job resource.
A Job is a resource that (just like a Deployment) will create one or more pods for us. It will then watch these pods and make sure they do what they need to do and exit successfully. When all the pods finish, the Job is then marked as completed and its work is done.
Let’s see an example: