Chapter 6. Jobs and CronJobs
A Job models a one-time process—for example, a batch operation. The Pod and its encompassed containers stop running after the work has been completed. CronJobs run periodically according to their defined schedules. A good application for a CronJob is a task that needs to occur periodically (for example, a process that exports data). In this chapter you will learn how to configure, run, and inspect a Job and a CronJob.
Working with Jobs
A Job is a Kubernetes primitive that runs functionality until a specified number of completions has been reached, making it a good fit for one-time operations like import/export data processes or I/O-intensive processes with a finite end. The actual work managed by a Job is still running inside of a Pod. Therefore, you can think of a Job as a higher-level coordination instance for Pods executing the workload. Figure 6-1 shows the parent-child relationship between a Job and the Pod(s) it manages.
Upon completion of a Job and its Pods, Kubernetes does not automatically delete the objects—they will stay until they’re explicitly deleted. Keeping those objects helps with debugging the command run inside of the Pod and gives you a chance to inspect the logs.
Get Certified Kubernetes Application Developer (CKAD) Study Guide, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.