Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 22/ 160
02. Workload Controllers & Scaling

Deployments: Managing Stateless Applications

Use Deployments as the standard controller for stateless app replica management.

BeginnerDeployment · Stateless · Replicas3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

A Deployment is a shipping lane that drives a new conveyor of labeled containers alongside the old one before retiring it. The simple Kubernetes rule is: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.

Think of it like…

A Deployment is a shipping lane that drives a new conveyor of labeled containers alongside the old one before retiring it.

Where you’ve seen it

During a release or scale event, the workload owner runs kubectl apply -f deployment.yaml && kubectl rollout status deployment/api. Expected evidence: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back. If the run instead shows this symptom, stop and restore the last known state: A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer.

Words you’ll hear

Deployment
For this lesson, Deployment is the controlling idea: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.
Stateless
Stateless is the checkpoint; run kubectl apply -f deployment.yaml && kubectl rollout status deployment/api and inspect the owner chain. A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer.
Replicas
Replicas is the outcome to preserve; the cost is explicit: Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications.
Verification evidence
The evidence command is kubectl apply -f deployment.yaml && kubectl rollout status deployment/api. It connects the declaration to this behavior: Use Deployments as the standard controller for stateless app replica management.

Visual diagram

Loading interactive diagram

Theory & deep dive

How Deployment reaches the intended state

Use Deployments as the standard controller for stateless app replica management. A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.

The concrete checkpoint is kubectl apply -f deployment.yaml && kubectl rollout status deployment/api; compare the Deployment owner, Stateless state, and Replicas outcome instead of treating YAML acceptance as proof.

Verify Stateless, not only object creation

Run kubectl apply -f deployment.yaml && kubectl rollout status deployment/api after the change and correlate the result with Events and the owning object. A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.

Key takeaway: Deployment is implemented only when this invariant remains observable: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.

Stateless: failure boundary and production cost

A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer. The prerequisite contract is concrete: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.

Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications. A safe design limits blast radius, records the last good configuration, and uses kubectl apply -f deployment.yaml && kubectl rollout status deployment/api as a deterministic rollback checkpoint.

Recover from Stateless drift

Capture the current state with kubectl apply -f deployment.yaml && kubectl rollout status deployment/api, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer.

Key takeaway: Accept the trade-off consciously: Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications.

How it works, step by step

Step 1 of 4
Workload author

1. Declare workload intent

Write the controller-owned Pod or scaling intent and preserve the owner chain: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.

Deployment contract → owned state
Key numbers at this step
Goal
Use Deployments as the standard controller for stateless app replica management.
Owner
Deployment

When to use it & trade-offs

What it is

Use Deployments as the standard controller for stateless app replica management. A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.

Why it matters: A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer. The invariant at risk is specific: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back. The quickest fact check before changing the design is kubectl apply -f deployment.yaml && kubectl rollout status deployment/api.

When to reach for it

  • Use Deployment to enforce this invariant: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.
  • Use Stateless evidence from kubectl apply -f deployment.yaml && kubectl rollout status deployment/api in reviews and incident timelines. Use Deployments as the standard controller for stateless app replica management.
  • Choose the progressive-delivery layer route only when this cost is justified by governance or scale: Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications.

When to avoid or be careful

  • Avoid assuming Deployment is complete after YAML submission; the required behavior is concrete: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.
  • Avoid treating the next symptom as random; check the owner and state with kubectl apply -f deployment.yaml && kubectl rollout status deployment/api first: A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications.

Native, manual, and managed paths for Deployment

Controller-managed workload
Best for: Use Deployments as the standard controller for stateless app replica management. A concrete incident check is kubectl apply -f deployment.yaml && kubectl rollout status deployment/api.

Strengths: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.

Watch out: Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications. Recovery must also recognize this signal: A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer.

Hand-managed Pods
Best for: Quickly testing the Stateless assumption with kubectl apply -f deployment.yaml && kubectl rollout status deployment/api; the expected invariant is: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.

Strengths: kubectl apply -f deployment.yaml && kubectl rollout status deployment/api gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike Deployment, it does not make this symptom self-documenting: A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer.

Progressive-delivery layer
Best for: Teams that need Replicas integrated with guardrails; the evidence path is kubectl apply -f deployment.yaml && kubectl rollout status deployment/api.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.

Watch out: The added platform ownership buys value at this cost: Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.
  • Trace Deployment to Replicas through Stateless; the invariant is: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.
  • Recognize the symptom: A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer.
  • Justify the cost: Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications.
  • Verify with kubectl apply -f deployment.yaml && kubectl rollout status deployment/api instead of only inspecting YAML.

Benchmarks & rules of thumb

2 -
ReplicaSets commonly coexist during a rolling update
1 -
pod-template hash identifies a Deployment-created ReplicaSet family
600s -
default progressDeadlineSeconds does not equal an application SLO

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the Deployment owner contract: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back.
  • Ignoring this telltale condition leads to unrelated changes: A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer.
  • Repeating kubectl apply -f deployment.yaml && kubectl rollout status deployment/api without an owner for remediation wastes retry cost. Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back?
  • Which owner object, logs, and Events would you inspect for this symptom-A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer-?
  • At what threshold would this cost become unacceptable: Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications?
Interview tip: Interview sequence: state the invariant, run kubectl apply -f deployment.yaml && kubectl rollout status deployment/api, name the failure, then justify the cost. Invariant: A Deployment owns ReplicaSets and changes the active one when a Pod template changes, while retaining revision metadata so a stateless app can be rolled forward or back. Failure: A Deployment can report progress while the new Pods still serve incorrect business behavior, because readiness checks are the only product health signal Kubernetes can infer. Cost: Deployments excel at replaceable instances but cannot provide stable identity or per-replica durable storage for stateful applications.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Deployments: Managing Stateless Applications with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
ReplicaSets & How Self-Healing Works
Next topic
Rolling Updates, maxSurge & maxUnavailable Strategies