Kubernetes is most famous for its ability to achieve a desired state automatically. That's how Kubernetes handles things like Deployments: You tell K8s what you want to deploy, and it figures out how best to deploy it. But sometimes, you have a specific task that needs to be automated, whether it's a one time thing, or a recurring one. Achieving that with Kuberntes requires a different set of primitives than describing a continuous desired state - which is what you’re usually doing with Kubernetes deployments.
The downside, though, is that Jobs and CronJobs can be tricky to monitor. Because most Kubernetes monitoring tools focus on more common Kubernetes objects, like Deployments and StatefulSets, getting visibility into the Kubernetes Jobs Scheduler and the processes it runs can be challenging.
That challenge can be solved, but doing so requires thinking outside the box of conventional Kubernetes monitoring. We explain how by first providing an overview of how Jobs and CronJobs work in Kubernetes, then discuss approaches to monitoring them so that you know if something goes wrong with a critical maintenance task.
Kubernetes Jobs and CronJobs: A brief overview
Jobs and CronJobs both allow Kubernetes admins to schedule specific tasks, then run them automatically. Again, unlike other Kubernetes objects, Jobs and CronJobs don't attempt to align operations with a desired state. Instead, they just complete a particular task, such as executing a command or running a script.
For example, here's the definition for a simple Job that runs a command using Perl:
Sign up for Updates
Let’s create your
account to get you started
Get ready to monitor everything you run on the cloud, instantly.
Leave your email below & we’ll send you a login link so you can complete everything from the comfort of your computer where groundcover works best.
See you on desktop!