Kubernetes Interview Questions
Explain what Kubernetes is reconciling and where to look for evidence when expected and actual state differ.
Try answering aloud before opening each explanation.
Try the Kubernetes practice demoFoundations
Why is a Pod rather than a container the scheduling unit?
Containers in one Pod are placed together and share a network namespace. Use this for tightly coupled processes that need to run together, not as a substitute for independent scaling.
What does a Deployment add on top of a ReplicaSet?
It manages ReplicaSets for successive versions of a Pod template, coordinates replacement and exposes rollout state. A ReplicaSet primarily maintains the desired count for one template.
What problem does a Service solve when Pods restart?
It gives clients a stable name and endpoint abstraction while selected Pods come and go. Traffic normally goes only to eligible endpoints, not to an arbitrary Pod IP remembered by a caller.
How do a resource request and limit differ?
Requests inform scheduling and resource allocation. Limits constrain use at runtime; CPU can be throttled while excessive memory use may lead to termination.
When would you choose a StatefulSet over a Deployment?
Use a StatefulSet when replicas need stable identities or per-replica persistent storage. It does not automatically replicate application data or make a database highly available.
Applied
How do readiness and liveness probes affect a Pod differently?
Readiness affects eligibility for Service traffic. Repeated liveness failures can restart a container. Do not use liveness to restart every instance just because a shared downstream service is temporarily down.
What does a startup probe change for a slow-starting workload?
Readiness and liveness probes do not run until the startup probe succeeds. This gives startup its own allowance without making recovery from later failures unnecessarily slow.
Why might an autoscaler add Pods that cannot start?
Scaling creates demand for more replicas but does not guarantee capacity. Inspect scheduling events, requested resources, placement rules and node capacity when replicas remain pending.
How can a ConfigMap update reach a running application?
Mounted files generally update eventually, but the application must reload them and subPath mounts do not receive updates. Values loaded as environment variables need a new Pod.
What can a PodDisruptionBudget protect against?
It limits supported voluntary evictions such as a node drain. It does not prevent unexpected node failure or replace a Deployment's own rollout availability configuration.
Production scenarios
A Pod stays Pending after deployment. What do you check first?
Read Pod conditions and events. Unschedulable usually means capacity or placement constraints, while a scheduled Pod can still wait for volume mounting or image retrieval.
How do you diagnose a container in CrashLoopBackOff?
Check the last termination reason and exit code, then read logs from the previous container. Compare recent config and probe changes; the backoff itself is not the root cause.
Why can a Service have no endpoints even if Pods are running?
The selector may not match the Pods or none may be ready. Check labels, namespace and EndpointSlices before assuming the network is broken.
How do maxSurge and maxUnavailable constrain a rolling update?
Surge allows temporary extra replicas; unavailable limits how far availability can fall relative to desired replicas. Account for capacity and time to readiness when selecting values.
What do you plan for when terminating a Pod during a rollout?
Allow for traffic routing to converge, stop accepting new work and drain in-flight requests within the grace period. Test real shutdown timing rather than assuming traffic stops immediately.
Further reading
Official documentation
Related question sets
- Node.js interview questions
- TypeScript interview questions
- REST API interview questions
- Microservices interview questions
- SQL interview questions
- Python interview questions
- JavaScript interview questions
- React interview questions
- System Design interview questions
- Java interview questions
- Docker interview questions
- MongoDB interview questions
- PostgreSQL interview questions
- Redis interview questions
- NestJS interview questions
- RabbitMQ interview questions