DaemonSets & CronJobs
Manage specialized workloads like node monitoring agents (DaemonSets), batch execution tasks (Jobs), and scheduled tasks (CronJobs).
1. Workload Types Comparison
| Kind | Execution Pattern | Primary Use Case |
|---|---|---|
DaemonSet | Ensures ALL (or selected) Worker Nodes run exactly 1 copy of the Pod | Log collectors (Fluentd/Logstash), Monitoring agents (Prometheus Node Exporter), Network CNI plugins |
Job | Runs Pods to completion once and exits with success status | Database migrations, batch data processing, backup generation |
CronJob | Runs Jobs on a recurring schedule using standard 5-field cron syntax | Nightly backups, cleanup scripts, automated daily reporting |
2. Production CronJob Manifest Example
apiVersion: batch/v1
kind: CronJob
metadata:
name: nightly-db-backup
spec:
schedule: "0 2 * * *" # Runs every night at 2:00 AM UTC
jobTemplate:
spec:
template:
spec:
containers:
- name: backup-script
image: postgres:15-alpine
command: ["/bin/sh", "-c", "pg_dumpall > /backups/db.sql"]
restartPolicy: OnFailureNext Up
Learn Namespaces & Multi-Tenancy: default vs custom namespaces (dev, prod), ResourceQuotas, and LimitRanges.
Next Lesson: Namespaces & Quotas →