Repaso
Español
Cloud & DevOpsIntermediateOPS-47

When would you use a StatefulSet, a DaemonSet, a Job or a CronJob instead of a Deployment?

Options

  1. StatefulSet: stateful. DaemonSet: per node. Job: once. CronJob: scheduled (Correct option)
  2. They are all identical, and any of them can replace a Deployment
  3. StatefulSet is for stateless apps and Job is meant for databases
  4. DaemonSet creates databases and CronJob scales Pods up and down

Answer

StatefulSet: stateful apps needing stable identity/storage (databases). DaemonSet: one Pod per node (log agents). Job: run a task to completion. CronJob: run a Job on a schedule

Why

Deployment fits stateless apps: any replica is interchangeable.

  • StatefulSet: Pods with stable names (db-0, db-1) and their own persistent volumes; for databases and brokers.
  • DaemonSet: ensures one Pod runs on each node: log collectors, monitoring agents.
  • Job: runs until it finishes successfully (a migration, a batch import).
  • CronJob: creates Jobs on a cron schedule (nightly report).

Remember

Stateless = Deployment. Stateful = StatefulSet. Per node = DaemonSet. Once = Job.

Key terms

Practice this question in Repaso