ReviseAlgo Logo

Kubernetes Workloads

DaemonSets and Jobs — Node-Level Tasks and One-Off Work

Running logs gatherers and batch tasks.

Interview: Interviewers will test your understanding of specialized workloads. Explain when to use DaemonSets (e.g. monitoring agents on every node) vs Jobs (one-off tasks like database migrations) vs CronJobs (scheduled cron tasks).

Last Updated: June 15, 2026 10 min read

Specialized Workloads Overview

Not all containerized applications are long-running web servers. Kubernetes provides specialized workload controllers to run background node daemons and batch execution tasks.

DaemonSets (One Pod Per Node)

A DaemonSet ensures that all (or some selected) Nodes run a copy of a Pod. As new worker nodes join the cluster, DaemonSet Pods are automatically scheduled on them. As nodes are removed, these Pods are automatically deleted.

Common DaemonSet use cases include:

  • Log collectors (e.g. Fluentd, Filebeat) shipping host and container logs.
  • Monitoring agents (e.g. Prometheus Node Exporter, Datadog agents).
  • CNI network plugins (e.g. Calico, Cilium).

Jobs and CronJobs (Batch Execution)

1. Jobs

A Job creates one or more Pods and ensures that a specified number of them successfully terminate. Unlike Deployments, which aim to keep containers running indefinitely, a Job runs until the task completes (e.g. database schema migrations, report generations, or image transcoding).

2. CronJobs

A CronJob manages Jobs on a time-based schedule, using standard cron syntax (e.g. 0 1 * * * for daily at 1:00 AM). It is commonly used for periodic tasks like database backups, cache updates, and log aggregation cleanups.

CronJob Manifest Example

apiVersion: batch/v1
kind: CronJob
metadata:
  name: DB-backup-job
spec:
  # Daily at midnight
  schedule: "0 0 * * *"
  # concurrencyPolicy: Forbid (prevents concurrent executions if previous run is still active)
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: backup-agent
            image: backup-tool:latest
            command: ["/bin/sh", "-c", "/scripts/backup-db.sh"]
          restartPolicy: OnFailure