Recipes

Deployment

Run a scheduled Kubernetes Job

Replace a simple Kubernetes CronJob with a Dagu schedule and a version-pinned Job image.

Supported platforms

LinuxmacOSWindows

Prerequisites

  • Kubernetes credentials available to Dagu
  • A version-pinned container image and suitable service account

Workflow YAML

description: Run a version-pinned container as a Kubernetes Job on a Dagu schedule.
schedule: "0 * * * *"

params:
  - name: namespace
    default: batch
  - name: image
    default: alpine:3.22.1
  - name: command
    default: echo 'replace this command with the batch job'

steps:
  - id: run_job
    action: kubernetes.run
    with:
      namespace: ${params.namespace}
      image: ${params.image}
      image_pull_policy: IfNotPresent
      command: ${params.command}
      cleanup_policy: delete
    timeout_sec: 1800

Review before running

Replace example values, configure the listed secrets, and review every command for your environment. Syntax validation does not make a community workflow trusted.

Running this workflow with a team?

The Team plan adds SSO, role-based access, audit logs, incident routing, and priority support for three self-hosted Dagu servers. Start a 14-day trial without a credit card.

Start Team trial
View sourceInstall DaguContributed by @dagucloud · validated with Dagu 2.13.0

Related Recipes