Member-only story

K8s 2023 Interview Questions — Job and CronJob

Tony
6 min readNov 20, 2023

What is a K8s Job, and how does it differ from a regular Pod?

A K8s Job is a specialized controller designed to manage and track tasks that run to completion. Unlike other K8s controllers, which manage desired state configurations like ensuring a certain number of replicas are maintained, a Job is specifically focused on tasks that run and finish, like batch processing or database migrations. Once a task completes (successfully or otherwise), the Job ensures that it doesn’t get restarted.

The primary difference between a K8s Job and a regular Pod lies in their purpose and lifecycle management. While a regular Pod can indeed run tasks to completion, its primary purpose isn’t specifically tailored for this. A Job, however, ensures task completion and provides capabilities to run multiple instances of a task, retrying tasks if they fail and more. It’s designed for batch-like processing, ensuring tasks are reliably executed to completion, even in the event of node failures or other interruptions.

How does a CronJob in K8s differ from a Job?

A CronJob in K8s is a higher-level construct that allows users to run jobs on a scheduled basis, much like the traditional UNIX “cron” utility. It’s designed for tasks that need to run…

--

--

Tony
Tony

No responses yet