Kubernetes interview questions
10 questions. CrashLoopBackOff, Pending pods, Services and endpoints, probes, requests and limits, rollouts, RBAC and NotReady nodes. Each has a strong answer of about a minute and the points an interviewer listens for.
01
A pod is in CrashLoopBackOff. Walk me through how you'd find out why.
A strong answer
First kubectl describe pod to read the events and the last state: it shows the exit code and reasons like OOMKilled or a failing liveness probe. Then kubectl logs with --previous, because the current container may have only just restarted and the error is in the last run. An exit code of 137 or OOMKilled means it hit its memory limit. If the logs show something like a missing setting, I'd check the ConfigMap, Secrets and environment variables it expects, and whether the liveness probe kills it before the app has started.
What the interviewer listens for
- Describe the pod and read its events. Events show the reason Kubernetes sees (OOMKilled, failed probe, image error) and exit codes.
- Read the logs of the crashed container. The current container may have just started; --previous shows why the last one died. Interviewers listen for it.
- Check the exit code or OOMKilled. An exit code of 137 or OOMKilled points straight at memory limits.
- Consider config and probes. Missing config and an over-eager liveness probe are the usual culprits.
Likely follow-up: “The logs are empty. What would you try next?”
Practise answering it02
What's the difference between a Pod and a Deployment? Why don't we usually create Pods directly?
A strong answer
A pod is the smallest unit Kubernetes runs: one or more containers sharing a network and storage. A Deployment manages pods for you: you say how many replicas you want, and through a ReplicaSet it keeps that many running, recreating any that die. It also does rolling updates to a new version and rollbacks. We don't create bare pods because if one dies or its node fails, nothing replaces it.
What the interviewer listens for
- A pod runs one or more containers. The basic definition.
- A deployment keeps a number of replicas running. The deployment's job is to keep N copies alive through a ReplicaSet.
- It handles rolling updates and rollbacks. Updates without downtime are the other big reason to use a deployment.
- A bare pod isn't replaced when it dies. This is the "why not" half of the question.
Likely follow-up: “When would you use a StatefulSet instead of a Deployment?”
Practise answering it03
Pods come and go with new IPs. How does a Service keep sending traffic to the right ones?
A strong answer
A Service has a label selector, for example app=checkout. Kubernetes keeps a list of endpoints, the IPs of the pods that match the selector and are ready, and updates it as pods are created or deleted. Clients use the Service's stable ClusterIP or its DNS name, and kube-proxy routes the traffic to one of those endpoints. A pod that fails its readiness probe is removed from the endpoints until it's ready again.
What the interviewer listens for
- A label selector picks the pods. The selector is the whole mechanism. Interviewers expect it first.
- Endpoints track the ready pods' IPs. Shows you know what changes behind the scenes.
- Only ready pods receive traffic. A pod that isn't ready is left out, which is why readiness probes matter.
- A stable name and virtual IP. Clients use one stable name while pods change underneath.
Likely follow-up: “A Service has no endpoints. What are the usual reasons?”
Practise answering it04
What's the difference between a liveness probe and a readiness probe? What happens when each one fails?
A strong answer
A liveness probe asks "is this container stuck?". If it fails, the kubelet restarts the container, which helps with a deadlocked or hung process. A readiness probe asks "can this pod take traffic right now?". If it fails, the pod stays running but is removed from the Service's endpoints, so it gets no traffic, which is right while it's warming up or a dependency is down. A common mistake is a liveness probe that checks the database, which restarts every pod when the database blips.
What the interviewer listens for
- A failed liveness probe restarts the container. The key behaviour of liveness.
- A failed readiness probe removes the pod from the Service. Readiness controls traffic, not restarts.
- When to use each. Good answers give the use case, like a hung process for liveness and a slow start for readiness.
Likely follow-up: “What's a startup probe for?”
Practise answering it05
What are resource requests and limits in Kubernetes, and what happens if a container goes over its memory limit?
A strong answer
Requests are what a container asks to be guaranteed: the scheduler uses them to pick a node with enough room. Limits are the maximum it may use. They behave differently for CPU and memory: a container that tries to use more CPU than its limit is throttled and gets slower, but one that goes over its memory limit is OOMKilled and restarted. So memory limits need some headroom above normal usage.
What the interviewer listens for
- Requests are used for scheduling. The scheduler uses requests to decide which node has room.
- Limits are the maximum a container may use. The other half of the definition.
- Over the memory limit, it's OOMKilled. The key consequence, and the cause of many restarts.
- Over the CPU limit, it's throttled. CPU and memory behave differently. Mentioning throttling shows real understanding.
Likely follow-up: “What happens if you set requests but no limits?”
Practise answering it06
How do you give an application its configuration and passwords in Kubernetes? Are Secrets actually secret?
A strong answer
Non-sensitive settings go in a ConfigMap and passwords or tokens in a Secret, and the pod reads them as environment variables or as files from a mounted volume. Secrets aren't very secret by default: they're only base64-encoded in etcd, so anyone who can read them can decode them. In practice you restrict who can read Secrets with RBAC, turn on encryption at rest for etcd, and often use an external store like Vault or a cloud secrets manager.
What the interviewer listens for
- ConfigMaps for normal settings, Secrets for sensitive values. Name both and what goes in each.
- Use them as environment variables or mounted files. How the app actually reads them.
- Secrets are only base64-encoded by default. The trap in the question. Base64 is not encryption.
- Protect them with RBAC or encryption. Saying how you'd actually protect them completes the answer.
Likely follow-up: “If you update a ConfigMap, does the running app see the change?”
Practise answering it07
How does Kubernetes roll out a new version of an app without downtime, and what do you do if the new version is broken?
A strong answer
A Deployment does a rolling update: it starts a few new pods, waits until they're ready according to their readiness probe, then removes old ones, controlled by maxSurge and maxUnavailable, so there are always pods serving. I'd watch it with kubectl rollout status and the error rate. If the new version is broken, kubectl rollout undo goes back to the previous ReplicaSet in seconds, and then we fix forward calmly.
What the interviewer listens for
- It replaces pods gradually. The basic mechanism.
- Readiness decides when it moves on. Without readiness probes, a rollout can send traffic to pods that aren't working yet.
- Roll back if it's broken. Knowing the undo command (or GitOps revert) is what they want for the second half.
- Watch the rollout. A safe rollout is watched, not fired and forgotten.
Likely follow-up: “How would you release to only 5% of users first?”
Practise answering it08
kubectl get nodes shows one node as NotReady. How would you investigate?
A strong answer
I'd start with kubectl describe node to read the conditions: memory or disk pressure, and when the kubelet last sent a heartbeat. Then I'd SSH to the node and check the kubelet with systemctl status kubelet and journalctl -u kubelet, because NotReady usually means it stopped reporting. Common causes are containerd being down, a full disk, a network or CNI problem, or an expired certificate. If it'll take a while, I'd cordon and drain the node so the pods move elsewhere.
What the interviewer listens for
- Describe the node and read its conditions. Conditions show memory or disk pressure and when the kubelet last reported.
- Check the kubelet on the node. NotReady usually means the kubelet stopped reporting. Its status and logs are the next step.
- Check the container runtime, disk and network. The common causes behind a sick kubelet.
- Drain or cordon it if needed. Protecting workloads while you fix it is good operational sense.
Likely follow-up: “journalctl shows the kubelet can't reach the API server. What now?”
Practise answering it09
Two teams share one cluster. How would you keep them from touching each other's applications?
A strong answer
I'd give each team its own namespace, then use RBAC: a Role with the permissions they need in their namespace and a RoleBinding to their group, so they can't change anything in the other team's namespace. A ResourceQuota per namespace keeps one team from using all the CPU and memory. And because namespaces don't block network traffic by themselves, I'd add NetworkPolicies so their pods can only talk to what they should.
What the interviewer listens for
- Give each team its own namespace. Namespaces are the unit everything else builds on.
- Restrict access with RBAC roles and bindings. RBAC is what actually stops one team from editing the other's resources.
- Limit resources per team. Stops one team from using up the whole cluster.
- Isolate the network if needed. Namespaces don't block traffic on their own. Network policies do.
Likely follow-up: “What's the difference between a Role and a ClusterRole?”
Practise answering it10
A new pod stays in Pending for minutes. What are the usual reasons, and how do you find which one it is?
A strong answer
I'd run kubectl describe pod and read the events: the scheduler says exactly why, like "0/3 nodes are available: insufficient memory". The usual reasons are requests larger than any node has free, placement rules no node matches such as taints without tolerations, a nodeSelector or affinity, and a PersistentVolumeClaim that can't be bound because there's no matching storage class or volume.
What the interviewer listens for
- Read the events with describe. The scheduler writes the exact reason into the pod's events.
- Not enough CPU or memory on any node. The most common reason: requests bigger than what any node has free.
- Taints, node selectors or affinity rules. Placement rules that no node satisfies are the second big reason.
- A volume claim that can't be bound. Pods with an unbound PVC wait in Pending too.
Likely follow-up: “The events say a node has a taint. What does that mean?”
Practise answering it
Ready for the real thing?
A timed interview asks questions like these one at a time, adds quick questions, a design and a hands-on task on a real machine, and ends with a hire or no-hire scorecard.
Take a practice interview