Commands icon
If icon
SlackIncomingWebhook icon
Schedule icon

Kubernetes CronJob and Batch Job Execution Failure Sentinel

Audits Kubernetes batch/v1 Jobs and CronJobs across all namespaces to detect failed executions and missed backup/ETL runs.

Categories
CloudInfrastructure

How it works

This workflow connects to the target Kubernetes cluster using kubectl inside a containerized runner. It audits all batch/v1 Jobs and CronJobs across all namespaces, specifically filtering for jobs reporting pod restart failures (status.failed > 0). When critical background batch tasks (such as database backup dumps, nightly data synchronization, or certificate renewals) fail, an automated incident notification is routed to Slack.

What you get

  • Proactive visibility into failed background batch workflows.
  • Prevents silent backup failures and delayed batch data pipelines.
  • Detailed breakdown of failing jobs, namespaces, and failure counts.

Who it's for

  • SREs and DevOps Engineers maintaining operational batch jobs in Kubernetes.
  • Data Engineers and DBAs running scheduled ETL transformations and database maintenance jobs.

Why orchestrate this with Kestra

  • Declarative Scheduling: Automate periodic batch health inspections on an hourly cadence.
  • Clean Extensibility: Easily chain with automatic pod log extraction or Jira issue creation.
  • Zero Server Footprint: Runs inside lightweight, secure container images.

Prerequisites

  • Cluster RBAC permissions allowing get and list on cronjobs.batch and jobs.batch.
  • Secret SLACK_WEBHOOK configured in Kestra.

Quick start

  1. Import this blueprint into Kestra.
  2. Configure the SLACK_WEBHOOK secret.
  3. Run the flow to audit batch execution health across all namespaces.

How to extend

  • Add an automated task using kubectl logs job/<name> to include container error logs in the alert.
  • Auto-retry transient failed jobs.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.