JuniorKubernetes

When would you use a Deployment versus a StatefulSet versus a DaemonSet?

What they are really testing: Whether you can match the workload controller to the workload shape. Using a Deployment for a database, or missing DaemonSets for node agents, is a common mistake.

A real interview question

When would you use a Deployment versus a StatefulSet versus a DaemonSet?

What most people say

drag me

You use a Deployment for most things; StatefulSets and DaemonSets are for special cases.

It does not say what makes those cases special. The distinction (stable identity/storage for StatefulSet, one-per-node for DaemonSet) is exactly what is being tested.

The follow-ups they ask next

  • Why does a database need a StatefulSet rather than a Deployment?

    Stable network identity and stable per-pod storage: each replica keeps its name and its own volume across restarts, and they start/stop in order, which clustered/stateful systems rely on. A Deployment treats pods as interchangeable and would break that.

  • How would you run a log-collection agent on every node?

    A DaemonSet: it ensures one pod per node and automatically adds the pod when new nodes join, which is exactly what node-level agents need.

What the interviewer is listening for

  • Deployment=stateless, StatefulSet=identity+storage, DaemonSet=per-node
  • Knows StatefulSet ordering + stable volumes
  • Mentions Jobs/CronJobs

What sinks the answer

  • Cannot say what makes StatefulSet special
  • Would run a DB as a Deployment
  • Unaware of DaemonSets for agents

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

Match the controller to the workload: [Deployment for stateless interchangeable replicas (web, APIs)]; [StatefulSet for stable identity + per-pod storage (databases, clustered systems), with ordered startup]; [DaemonSet for one pod per node (log/metrics agents, plugins)]. For run-to-completion work, [a Job or CronJob]. The classic mistake: [a database as a plain Deployment].

Keep going with kubernetes

All 336 cloud engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free