⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Kubernetes Interview Questions Scenario 7 of 207 in Kubernetes
Senior DevOps / DevSecOps Kubernetes Core Workload Primitives Core Architecture
🎯 Target Role / Context: Kubernetes Architecture Fundamentals

Q: In Kubernetes, what is the difference between Deployment, StatefulSet, and DaemonSet?

Clear decision matrix distinguishing Kubernetes Deployment, StatefulSet, and DaemonSet controllers, covering pod identity, network identity, persistent volume lifecycle, and per-node scheduling.

#Kubernetes #Workloads #Deployment #StatefulSet #DaemonSet #Storage #Comparisons
🎙️ Candidate Opening & Architectural Context
"In production, selecting the wrong workload controller leads to data corruption, deployment deadlocks, or wasted compute. I categorize them by statefulness, pod identity, and placement topology."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's CKA & CKAD Hands-On Certification Track covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: In production, selecting the wrong workload controller leads to data corruption, deployment deadlocks, or wasted compute. I categorize them by statefulness, pod identity, and placement topology.

1️⃣

Deployment: Stateless, Interchangeable Workloads

Designed for stateless microservices, web apps, and API gateways where pods are ephemeral and interchangeable:

  • Pod Identity: Pods receive random hash suffixes (e.g. api-7d58f97b6b-4kx9l). Any pod can serve any request.
  • Storage: Typically stateless. If mounting PersistentVolumes (PV), all replicas share the same ReadWriteMany (NFS/EFS) volume or ephemeral emptyDir.
  • Rollouts: Controlled by ReplicaSets with declarative RollingUpdate or Recreate strategies.
2️⃣

StatefulSet: Ordered, Stateful & Identity-Preserving Workloads

Designed for databases, distributed storage, and clustered systems (Kafka, Elasticsearch, PostgreSQL, Redis Cluster, ZooKeeper):

  • Predictable Identity: Pods get deterministic, zero-indexed ordinal names (e.g. kafka-0, kafka-1, kafka-2).
  • Headless Service & DNS: Uses clusterIP: None so each pod receives a distinct DNS entry (e.g. kafka-0.kafka-headless.prod.svc.cluster.local) essential for leader election and cluster peering.
  • volumeClaimTemplates: Each replica dynamically provisions its own dedicated, persistent disk that survives pod recreation or rescheduling.
  • Ordered Deployment & Termination: Deploys sequentially (0 ➔ 1 ➔ 2) and shuts down in reverse order to preserve quorum.
Advertisement
3️⃣

DaemonSet: Exactly One Pod Per Node Workloads

Ensures that a copy of the pod runs on every matching node in the cluster:

  • Node-Bound Placement: Pods are automatically scheduled when a new node joins the cluster and garbage collected when the node is decommissioned.
  • Primary Use Cases: Cluster observability agents (Datadog, Fluentbit, Prometheus Node Exporter), networking CNI plugins (Calico, AWS VPC CNI, Cilium), and security runtimes (Falco, Sysdig).
  • Tolerations: DaemonSets typically tolerate node.kubernetes.io/unschedulable and master/control-plane taints to monitor every physical host.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Use Deployments for interchangeable stateless APIs; StatefulSets for quorum-based, disk-backed databases needing deterministic DNS and storage; and DaemonSets for infrastructure agents (CNI, logging, metrics, security) that must live on every physical node."
⚡ 60-Second Elevator Pitch Talking Points
  • Deployment: Stateless apps (APIs, web apps); random pod hashes; shared or no persistent disk; rolling updates.
  • StatefulSet: Clustered databases (Kafka, Postgres, Redis); deterministic ordinal names (app-0, app-1); dedicated volumeClaimTemplates; headless service DNS.
  • DaemonSet: Infrastructure agents (Fluentbit, Node Exporter, Cilium, Falco); runs exactly one pod per node automatically as nodes scale.
  • Pro-Tip: Never run databases on Deployments with ReadWriteOnce EBS volumes—pods will fail to remount across nodes due to multi-attach errors.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Over-granting cluster-admin permissions to pod ServiceAccounts instead of scoping namespace Roles when configuring Deployment StatefulSet DaemonSet Over-granting cluster-wide permissions violates least-privilege principles and allows compromised pods to escalate privileges across namespaces.
  2. Referencing mutable latest container tags across production Kubernetes Deployment specs when configuring Deployment StatefulSet DaemonSet Deployments referencing :latest risk inconsistent versions across replica pods and break deterministic rollback capabilities.
  3. Omitting pod readiness probes, causing traffic to hit uninitialized application containers when configuring Deployment StatefulSet DaemonSet Readiness probes gate traffic delivery; missing probes cause Kubernetes to route user requests to pods before dependencies or caches are loaded.
  4. Executing diagnostic triage without analyzing chronological cluster events and describe outputs when configuring Deployment StatefulSet DaemonSet Cluster events provide sequential timestamps of scheduler decisions, probe failures, and image pull timeouts essential for rapid root-cause isolation.
Advertisement
📥 FREE DOWNLOAD · 101-PAGE COMPANION HANDBOOK
Studying for Kubernetes & SRE Technical Rounds?
Download the complete 100-question PDF field guide covering all 11 core modules with offline diagnostic runbooks.
📥 Download PDF (Free) Read Online Guide →
Want more Kubernetes scenarios?
Explore our complete collection of scenario-based Kubernetes interview runbooks.
Browse All Kubernetes Questions →