← Back to Infrastructure

K8s — Pod vs Deployment

InfrastructureMidkubernetes

The Question

What is the difference between a Kubernetes Pod and a Deployment?

What a Strong Answer Covers

  • pod = smallest unit
  • "deployment = ReplicaSets + rolling updates

Senior-Level Answer

A Pod and a Deployment solve different problems in Kubernetes. Understanding the distinction is fundamental to using Kubernetes correctly.

**Pod** is the smallest deployable unit in Kubernetes. It encapsulates one or more containers that share a network namespace (same IP address and localhost), storage volumes, and lifecycle. Containers in a pod are always co-scheduled on the same node. Pods are ephemeral by design — they are not self-healing. If a Pod crashes, is evicted, or the node it runs on fails, the Pod is gone. Creating a Pod directly with `kubectl apply` gives you exactly one instance that will never be replaced.

**Deployment** is a controller that manages a **ReplicaSet**, which in turn manages a set of identical Pods. You declare desired state — "I want 3 replicas of this container image" — and the Deployment controller continuously reconciles actual state to match. Key capabilities:

- **Self-healing**: if a Pod crashes or a node goes down, the Deployment's ReplicaSet replaces it automatically by scheduling a new Pod on a healthy node. - **Scaling**: `kubectl scale deployment my-app --replicas=10` adds Pods; the controller handles scheduling. - **Rolling updates**: update the container image in the Deployment spec, and Kubernetes progressively replaces old Pods with new ones (configurable with `maxUnavailable` and `maxSurge`). Zero-downtime deployments by default. - **Rollback**: `kubectl rollout undo deployment/my-app` reverts to the previous ReplicaSet instantly — the old ReplicaSet is retained for this purpose. - **History and audit**: Deployment revision history records what changed and when.

**When to use a Pod directly**: rarely, and only for debugging, one-off inspection tasks, or very simple local development. A standalone Pod provides no resiliency.

**Other controllers**: Deployments are for stateless workloads. For stateful workloads (databases, message queues with persistent storage), use a **StatefulSet** which assigns stable network identities and ordered rolling updates. For per-node daemons (log collectors, monitoring agents), use a **DaemonSet**.

The mental model: a Deployment is a specification of desired state for Pods over time; a Pod is a single instance of that desired state at a point in time.

Key Differences

AspectPodDeployment
Abstraction levelLowest — single instanceController managing ReplicaSet + Pods
Self-healingNo — if it dies, it's goneYes — replaces failed Pods automatically
ScalingManual — one pod per manifestkubectl scale or HPA autoscaling
Rolling updatesN/ABuilt-in with maxUnavailable/maxSurge
RollbackNokubectl rollout undo
Use caseDebugging, one-off tasksProduction stateless workloads
Manages stateNoTracks revision history and desired replicas

What Separates a 2/3 from a 3/3

2/3 — Passing but Incomplete

Correctly explains that Pods are ephemeral and not self-healing, explains that a Deployment manages ReplicaSets which manage Pods, and describes rolling update and rollback capabilities.

3/3 — Strong Answer

Covers the Deployment → ReplicaSet → Pod hierarchy, explains maxUnavailable/maxSurge configuration for rolling updates, distinguishes Deployments from StatefulSets and DaemonSets for other workload types, and gives a concrete scenario for when you'd use each.

Common Mistakes

  • Saying a Deployment 'manages Pods directly' — it manages a ReplicaSet, which manages Pods.
  • Not explaining why you should almost never create standalone Pods in production.
  • Forgetting that the old ReplicaSet is retained after a rollout, enabling rollback.
  • Not distinguishing stateless (Deployment) vs. stateful (StatefulSet) workloads — a very common interview follow-up.

Follow-Up Questions

  • What is a ReplicaSet and why does a Deployment create one rather than managing Pods directly? — ReplicaSet ensures N copies of a Pod spec are running; Deployment manages multiple ReplicaSets over time (one per revision) to enable rollouts and rollbacks.
  • How would you perform a zero-downtime deployment with a Deployment? — Set maxUnavailable=0 and maxSurge=1 (or 25%) in the rolling update strategy; Kubernetes adds new pods before removing old ones; add readiness probes so traffic only routes to healthy pods.
  • When would you use a StatefulSet instead of a Deployment? — Stateful workloads needing stable network identity (DNS names like pod-0, pod-1), ordered rolling updates, and per-pod persistent volumes — databases, Kafka, ZooKeeper.
  • How does a Horizontal Pod Autoscaler interact with a Deployment? — HPA watches CPU/memory metrics (or custom metrics) and adjusts the Deployment's replica count automatically; the Deployment's controller then schedules or terminates Pods to match the new replica count.

Related Questions

  • K8s — Liveness vs Readiness
  • K8s — ConfigMap vs Secret
  • Helm Chart
  • Docker — Container vs VM
  • CI/CD Pipeline

Can You Explain This Cold?

Reading the answer is step one. Explaining it unprompted — under interview pressure — is what actually matters. Get AI-graded feedback on your answer with follow-up probes on your weak points.

Get Graded — Free Assessment
GrindQuestionsAITechnical interview assessment
TermsPrivacyAbout