Kubernetes Interview & Revision
A tight, high-signal pass over the questions, quick-reference notes, and cheat sheet you'd want the night before a systems design or infrastructure interview.
Kubernetes Interview Questions and Answers
Kubernetes interview questions and answers: the questions that come up again and again, with concise, correct answers.
What is Kubernetes and why use it over plain Docker?
Kubernetes orchestrates containers across many machines — scheduling, self-healing, service discovery, rolling deployments and autoscaling — things plain Docker on a single host cannot do.
What happens when a Pod crashes?
If only a container crashes, the kubelet restarts it in place per the Pod's restartPolicy. If the Pod itself is lost (node failure, eviction), the ReplicaSet notices current replica count no longer matches desired count and creates a brand-new Pod to close the gap.
Difference between a Deployment and a ReplicaSet?
A ReplicaSet keeps N Pods running; a Deployment manages ReplicaSets to support versioned rollouts and rollbacks.
Difference between readiness and liveness probes?
Readiness controls whether a Pod receives traffic (Service endpoints); liveness controls whether the container gets restarted.
How does a Service find Pods?
Via label selectors — the Service continuously maintains a list of Endpoints matching its selector, updated as Pods come and go.
How does the scheduler decide where a Pod runs?
Two phases: filtering out nodes that can't satisfy the Pod's requirements, then scoring the remaining nodes and picking the best.
How does a rolling update avoid downtime?
New Pods are created and must pass readiness before old Pods are terminated, governed by maxSurge/maxUnavailable — capacity never drops below the configured threshold.
What's the difference between a ConfigMap and a Secret?
Both inject key-value configuration into Pods; Secrets are intended for sensitive data, base64-encoded and typically more tightly access-controlled — but not encrypted by default.
How does the HPA decide to scale?
It polls the metrics API for observed resource usage (e.g. CPU) against a target utilization, and adjusts replica count to close the gap — on a polling interval, not instantly.
What happens if a whole node fails?
The node controller detects missed heartbeats, marks the node NotReady, and eventually the Pods that were on it are evicted and rescheduled onto healthy nodes.
Revision Notes
The shortest possible summary of each core concept.
Control plane: API Server (front door) → etcd (state) → Scheduler (placement) → Controllers (reconciliation).
Workload chain: Deployment (rollout strategy) → ReplicaSet (replica count) → Pod (running unit).
Networking chain: Client → Ingress (HTTP routing, optional) → Service (stable IP + load balancing) → Pod.
Reliability primitives: Liveness (restart), Readiness (traffic routing), HPA (replica count vs metrics), ReplicaSet (replica count vs failures).
Config primitives: ConfigMap (non-sensitive config), Secret (sensitive config), PVC/PV (durable storage).
Quiz
Answer these before checking the revision notes above — if any feel shaky, that's exactly the chapter to re-read.
1. What's the difference between a Pod and a container? 2. Why does a Deployment create a new ReplicaSet during a rolling update instead of modifying the existing one? 3. If a readiness probe fails, is the Pod restarted? Why or why not? 4. What data does a Service actually track to know which Pods to route to? 5. Why is it wrong to depend on a Pod's IP address directly? 6. What's the two-phase model the scheduler uses to place a Pod? 7. Why does HPA math depend on CPU requests rather than limits? 8. What's the practical difference between a ConfigMap and a Secret, given both store key-value data? 9. What component of the control plane would you check first if a node stopped receiving new Pods? 10. Why do PVCs exist separately from Pods at all?
Cheat Sheet
The commands and comparisons worth having memorized.
kubectl get pods
kubectl describe pod <name>
kubectl logs <name> --previous
kubectl apply -f deployment.yaml
kubectl rollout status deployment/app
kubectl rollout undo deployment/app
kubectl scale deployment/app --replicas=5
kubectl get hpa
kubectl top pods- 01Deployment → ReplicaSet → Pod: rollout strategy, replica count, running unit.
- 02Liveness = restart; Readiness = traffic routing.
- 03Service = stable address + Endpoints; Ingress = HTTP-aware routing in front of Services.
- 04ConfigMap = non-sensitive config; Secret = sensitive config (base64, not encrypted by default).
- 05PVC/PV = storage lifecycle independent of any one Pod.
- 06Desired state vs current state reconciliation is the idea underlying almost everything Kubernetes does automatically.