Skip to content

Questions and answers

Senior-level Kubernetes interview questions

Twelve questions that come up for senior backend and Java engineers. Each answer is short enough to say out loud, and links to the page where you can watch it happen.

Pods and restarts

  1. What is the difference between CrashLoopBackOff and OOMKilled?

    They are different kinds of fact. OOMKilled is a reason one container ended: it exceeded its memory limit and the kernel killed it, exit code 137. CrashLoopBackOff is a state: the container keeps ending, for any reason, and the kubelet is waiting longer before each restart. A container that is OOMKilled repeatedly ends up in CrashLoopBackOff, so check the Last State reason and exit code to see which cause is behind the loop.

  2. Why would a pod be Running but not Ready?

    Running means the container process is up. Ready means the pod may receive traffic. A pod is Running and 0/1 when its readiness probe is failing, when its startup probe has not passed yet, or when a readiness gate is unmet. It is left alone, not restarted, and kept out of the Service's endpoints until the probe passes.

  3. How do you troubleshoot a pod stuck in Pending?

    Pending means the scheduler has not found a node. Run kubectl describe pod and read the FailedScheduling event: it lists how many nodes were rejected and why, such as insufficient CPU or memory for the pod's requests, a taint it does not tolerate, a node selector or affinity nothing matches, or a volume claim that cannot be bound. Then fix that one reason: free or add capacity, lower the requests, add a toleration or correct the selector.

  4. What happens if a readiness probe fails?

    After failureThreshold failures in a row the kubelet marks the pod not ready. The EndpointSlice controller removes it from the Service's endpoints, so it stops receiving new traffic. The container is not restarted. When the probe passes again the pod is added back. If every pod fails readiness at once, the Service has no endpoints and all requests fail.

Nodes, traffic and networking

  1. What happens when a Kubernetes node suddenly goes down?

    The kubelet stops renewing its heartbeat. After the grace period, 50 seconds by default, the node controller marks the node NotReady or Unknown and taints it. Pods on it are removed from Service endpoints, so traffic moves to pods elsewhere. Pods tolerate the taint for 300 seconds by default; after that they are evicted and their controllers create replacements on healthy nodes. Pods with ReadWriteOnce volumes can take longer, because the volume must detach first.

  2. How does Kubernetes distribute traffic between replicas?

    A Service has a virtual IP. kube-proxy on every node programs rules that send each new connection to one of the Service's ready endpoints: chosen at random in the default iptables and nftables modes, round robin by default in IPVS mode. The choice is made per connection, not per request, so long-lived connections such as HTTP/2 or gRPC can leave load uneven. Only pods that are Ready are in the list.

  3. How do you troubleshoot intermittent service-to-service communication?

    Intermittent usually means one of several paths is bad. Check the Service's EndpointSlices and call each pod IP directly to find a pod that is Ready but broken. Test DNS from the calling pod, since slow or failing lookups look like random errors. Note whether failures are instant (refused: nothing listening) or slow (timeout: packets dropped, often a NetworkPolicy). Then check for restarts, rollouts or readiness flapping at the times of the failures.

Scaling, releases and performance

  1. How does HPA calculate the number of replicas?

    desiredReplicas = ceil(currentReplicas × currentMetricValue ÷ desiredMetricValue). With 3 replicas at 140% CPU utilisation against a 70% target, that is ceil(3 × 140 ÷ 70) = 6. Utilisation is measured against the pods' CPU requests, so without requests there is nothing to compute. The result is clamped between minReplicas and maxReplicas, small differences within a tolerance are ignored, and scale-down waits for a stabilisation window.

  2. How would you deploy a new version without downtime?

    Use a rolling update with a readiness probe, so new pods only receive traffic once they can serve and old pods are only removed after that. Set maxUnavailable so capacity never drops too far. Handle shutdown too: a preStop pause and graceful termination let in-flight requests finish. Keep changes backwards compatible, run smoke tests in the pipeline, and use a canary for critical services. Keep kubectl rollout undo ready.

  3. How do you troubleshoot high JVM memory usage inside a container?

    Separate heap from everything else. The container limit covers the whole process: heap, metaspace, thread stacks, direct buffers and native memory. Compare kubectl top with the limit, then look at heap and non-heap in the JVM's own metrics. Cap the heap at a share of the limit, for example -XX:MaxRAMPercentage=70, never at the full limit. A steady climb over hours means a leak, and a heap dump will show what is being held.

  4. What happens when a pod exceeds its CPU limit?

    Nothing is killed. The kernel throttles the container: once it has used its quota for the current period, 100ms by default, it is paused until the next period begins. The app gets slower, with latency spikes even at modest average CPU, and the pod never restarts. This is the opposite of memory, where exceeding the limit ends the container.

  5. How would you investigate a sudden increase in API latency?

    Work from the outside in. Check that pods are healthy and not restarting. Look at CPU and memory against their limits, and at CPU throttling. Check whether the autoscaler is scaling or stuck at maxReplicas. Then look inside the app: garbage collection, thread and connection pools, and the latency of the database and other dependencies. Mitigate with more replicas or CPU if the service is the bottleneck, and fix the dependency if it is not.

Sources: Kubernetes docs: Horizontal pod autoscaling ↗ · Kubernetes docs: Virtual IPs and service proxies ↗ · Kubernetes docs: Pod lifecycle ↗ · Kubernetes docs: Nodes ↗ · Report a problem

Terminal output is illustrative. All wording is original and paraphrases the linked Kubernetes documentation.

Practise: diagnose the cluster

Read the terminal, watch the animation, pick the error and the first fix.

Play