Kubernetes Architecture, Operations, and Troubleshooting Questions
How Kubernetes works, how to run it, and how to debug it. Covers control-plane and node components, the scheduler and API server, cluster design, high availability and multi-cluster topologies, and platform-level operations; the workload primitives (pods, deployments, services, controllers), cluster upgrades, and designing Kubernetes as an internal platform; and the operational depth inside a cluster including pod and service networking, ingress and the CNI model, service mesh, persistent volumes and storage classes, resource requests and limits, and systematically diagnosing scheduling, networking, and storage failures. The full architecture-through-day-two-operations span of Kubernetes.
Given a Kubernetes cluster where many pods are OOMKilled, several pods are stuck in Pending due to insufficient resources, and multiple PersistentVolume attach operations are failing with 'volume not found', outline a step-by-step triage and remediation plan. Include specific kubectl commands to inspect events, logs, node conditions, PV/PVC states, and cloud provider attachment states, and describe immediate mitigations and long-term fixes.
Sample Answer
With three simultaneous failure classes (OOMKilled pods, Pending pods, failing PersistentVolume, or PV, attachments), triage them as three parallel tracks rather than one linear investigation, because they usually share a root cause (a node pool that's undersized or a zone that's lost capacity) even though the visible symptoms look unrelated.
Establish scope first
Before diving into any single pod: how many namespaces and node pools are affected, is this one zone/region or the whole cluster, and what changed recently (a deploy, a node pool resize, a cloud maintenance event)? This determines whether you're chasing an application-level regression or an infrastructure-level capacity problem.
Track 1: OOMKilled pods
kubectl get pods --all-namespaces -o json | jq -r '.items[] | select(.status.containerStatuses[]?.state.terminated.reason=="OOMKilled") | "\(.metadata.namespace)/\(.metadata.name)"'
kubectl describe pod <pod> -n <ns>
kubectl logs <pod> -n <ns> --previous
OOMKilled means the container tried to use more memory than its limit and the kernel's out-of-memory killer terminated it; the container status's terminated.reason field is the authoritative signal, not an inference from the logs. Check whether the limit is simply too low for real usage (raise it) versus a genuine memory leak (the previous container's logs right before termination usually show the growth pattern).
Track 2: Pending pods (insufficient resources)
kubectl get pods --all-namespaces --field-selector=status.phase=Pending -o wide
kubectl describe pod <pod> -n <ns> # Events: "Insufficient cpu" / "Insufficient memory"
kubectl top nodes
kubectl describe pod for a resource-starved Pending pod names the exact resource the scheduler couldn't find room for. If every node reports high utilization in kubectl top nodes, this is a genuine capacity shortage, not a scheduling bug, and Cluster Autoscaler should be adding nodes; check whether it's actually trying to (see node conditions and Cluster Autoscaler's own logs) or whether it's blocked by a quota, a node-group max size, or a taint no pending pod tolerates.
Track 3: PV attach failures ("volume not found")
kubectl get pvc --all-namespaces
kubectl describe pvc <pvc> -n <ns>
kubectl get pv
kubectl describe pv <pv>
kubectl -n kube-system logs deploy/<csi-controller-deployment>
"Volume not found" reported by the attach path usually means the cloud-side disk resource itself is gone or was never created successfully, most often because it was deleted out of band (manual cleanup, a lifecycle policy) or the PV object still references a volume ID from a node/zone that no longer matches where the pod is now scheduled. Confirm directly against the cloud provider whether the volume actually exists before assuming this is a Kubernetes-side bug.
Node health, feeding all three tracks
kubectl get nodes
kubectl describe node <node>
kubectl get node <node> -o json | jq '.status.conditions'
A node reporting MemoryPressure explains OOM kills and Pending pods at once (the kubelet has started evicting to reclaim memory and refusing new pods); a node stuck NotReady explains all three symptoms simultaneously, since its pods, its scheduling eligibility, and any volumes it held all become unavailable together.
Immediate mitigations
- Free memory headroom by scaling down non-critical Deployments/Jobs rather than immediately trying to add capacity, if the cluster is at a hard ceiling (quota, budget) that a scale-up can't fix quickly.
- Cordon a genuinely unhealthy node so nothing new schedules there while it's investigated:
kubectl cordon <node>. - For a stale volume attachment record (the cloud API shows the volume detached but Kubernetes still thinks it's attached to a dead node), reconciling usually requires confirming the volume's real state directly against the cloud provider and only then deleting the stuck pod so the kubelet re-attempts attach against the corrected state; never force-detach a volume that a live pod might still be writing to.
Long-term fixes
- OOM: right-size requests/limits from real usage data, and use the Horizontal Pod Autoscaler where the workload can scale out instead of needing ever-larger single pods.
- Pending: validate Cluster Autoscaler is actually configured for the node pools and instance types this workload needs, and separately validate cloud quota for those instance types isn't the real ceiling.
- PV attach: keep the CSI driver current, confirm its controller has the cloud permissions it needs, and prefer a shared storage class (for workloads that support it) over single-attach block storage where node/zone mobility matters.
- Across all three: centralized metrics (node and pod resource usage, PersistentVolume attach latency and error rate) and alerting on the leading indicators (rising memory pressure, climbing Pending count, provisioner error rate) rather than discovering the incident from user-facing failures.
Trade-offs and pitfalls
- Scaling out nodes quickly buys time but can mask an underlying resource-request misconfiguration that will resurface at the next load spike; treat a capacity add as a stabilization step, not the fix.
- Force-detaching a volume without confirming its real state first risks corrupting in-flight writes; always verify before forcing.
- Because these three symptoms often share one root cause, fixing them independently in parallel without a shared postmortem risks three separate, redundant remediations instead of one real fix to node/zone capacity planning.
In a multi-region cluster deployment your etcd cluster split its quorum and API servers began failing writes. Describe immediate safe remediation steps to restore etcd availability and consistency (including when to stop writes, how to rejoin members or promote a healthy quorum), and propose long-term architecture patterns to reduce the risk of region-level quorum loss.
Sample Answer
Direct answer
etcd is a CP (consistency-favoring) system built on Raft consensus: a write only commits once a strict majority of voting members acknowledge it. When a network partition splits the cluster, at most one side can hold a majority, and that side may keep serving; everything else must refuse writes to avoid split brain. The immediate job in this incident is not to restore write availability by any means necessary, it is to work out which side, if any, already holds a majority and point API servers only at that side. You touch cluster membership only if no side has a majority, and even then you rebuild from a snapshot rather than force a quorum change against live, disconnected data.
Structured elaboration
Step 1: read state before acting, on every reachable member
etcdctl endpoint status --cluster -w table
etcdctl member list -w table
etcdctl endpoint health --cluster
(etcdctl defaults to the v3 API since etcd 3.4, so exporting ETCDCTL_API=3 is no longer required, though a runbook that still sets it is harmless.)
Illustrative shape of the output you are reading for:
+----------------+------------------+---------+-----------+-----------+
| ENDPOINT | ID | VERSION | IS LEADER | RAFT TERM |
+----------------+------------------+---------+-----------+-----------+
| 10.0.1.10:2379 | 8211f1d0f64f3269 | 3.5.x | true | 42 |
| 10.0.1.11:2379 | 91bc3c398fb3c146 | 3.5.x | false | 42 |
| 10.0.2.10:2379 | unreachable | - | - | - |
+----------------+------------------+---------+-----------+-----------+
A member showing unreachable, or a raft term that keeps climbing between polls, marks the partition boundary and tells you whether the reachable side is stably elected or still thrashing.
Step 2: do the quorum arithmetic before deciding anything
For an n-member cluster, majority = floor(n/2) + 1. Compare the number of members reachable from a candidate side against that number.
- If one side already meets majority: that side is the live cluster. Repoint kube-apiserver's
--etcd-serversat that side only. Do not touch membership. Let a few election cycles settle, then resume writes. - If no side meets majority: the cluster is down for writes everywhere. Two paths remain: repair the network so the majority side becomes reachable again (fastest, no data risk), or, if the network cannot be fixed quickly, restore a new cluster from the most recent consistent snapshot taken from the member with the highest committed index.
Step 3: membership commands are for a live cluster, not a way to resurrect a dead one
etcdctl member remove / member add only make sense issued against a client already talking to a live majority. Running them from an isolated minority does not restore quorum, it creates a second, diverging cluster that will conflict with the real majority once the network heals. If you must rebuild, restore the snapshot into a brand-new cluster ID and repoint the API servers; do not try to vote in new members from a minority island.
Step 4: rejoin recovered nodes as learners, not straight back in as voters
Since etcd 3.4, etcdctl member add <name> --learner adds a non-voting member that replicates the log without changing the size of the quorum; once etcdctl member status shows it has caught up, etcdctl member promote <id> makes it a voter. This is also the mechanism kubeadm uses to safely rejoin a control-plane node's etcd member today. Adding a recovered node straight back in as a voter while it is still behind is what turns a partial outage into a full quorum loss, because the quorum denominator grows before the member can contribute a useful vote.
flowchart TB
subgraph RegionA["Region A: 3 members, has majority"]
A1[etcd-1]
A2[etcd-2]
A3[etcd-3]
end
subgraph RegionB["Region B: 2 members, no majority"]
B1[etcd-4]
B2[etcd-5]
end
RegionA -.network partition.- RegionB
Worked example (quorum arithmetic, not a timing claim)
Take the scenario as posed: a 5-member cluster split by a region-level partition, 3 members in Region A and 2 in Region B.
majority=⌊5/2⌋+1=3
Region A has 3 reachable members, meeting the majority threshold, so Region A is the live cluster and can keep serving writes. Region B has only 2, below majority, and correctly refuses writes: those are the API servers "failing writes" in the prompt. The fix is to repoint them at Region A's endpoints, not to force anything in Region B.
Contrast this with the related but distinct failure the note asks to fold in: instead of a network partition, 2 of the 3 voting members in a 3-member cluster actually crash (disk failure, nodes terminated).
majority=⌊3/2⌋+1=2
Only 1 member remains, below the majority of 2, so no side anywhere has quorum; every remaining node refuses writes. This is strictly worse than a partition with a majority on one side, because there is no "point the API server elsewhere" fix available. You must either bring back one of the failed members with its original data disk intact (fastest, no data loss) or restore the newest snapshot into a fresh cluster (which loses anything written after that snapshot).
Trade-offs and pitfalls
- The most common mistake under pressure is forcing
member remove/member addfrom the minority side. It does not restore quorum; it manufactures a diverging cluster that corrupts state once connectivity returns. - Restoring from snapshot is safe but lossy for anything committed after the snapshot; treat it as a last resort, not the default response to any quorum event.
- Long term, do not stretch one etcd cluster's voting membership across regions with materially different network reliability. Keep the voting majority co-located in the most reliable region (odd counts: 3, 5, 7) and use non-voting learners in remote regions as warm standbys, or run fully separate regional control planes joined by a higher-level coordination layer instead of one cross-region etcd.
- Automate and rehearse snapshot backups and restore drills. An incident is the wrong time to discover the only backup is stale or the restore runbook has never actually been run.
You are troubleshooting PersistentVolumeClaim (PVC) not binding to any PersistentVolume (PV). Describe the steps to debug PV/PVC binding: inspect storage class, volumeMode, accessModes, reclaimPolicy, CSI provisioner logs, and cloud provider storage quotas. Provide kubectl commands and sample outputs you would expect in common failure cases.
Sample Answer
A PersistentVolumeClaim (PVC, a request for storage made by a workload) that never binds means either no matching PersistentVolume (PV, the actual piece of storage) exists yet, the StorageClass's provisioner is failing to create one, or a cloud-side constraint (quota, permissions) is blocking provisioning; the fix is to work through those three in order rather than guess.
1. Inspect the PVC itself
kubectl get pvc -n myns my-pvc -o yaml
Read status.phase, spec.storageClassName, spec.volumeMode (Filesystem or Block), spec.accessModes (ReadWriteOnce, ReadWriteMany, etc.), and spec.resources.requests.storage. A very common, entirely benign-looking state:
status:
phase: Pending
Events:
Type Reason Message
---- ------ -------
Normal WaitForFirstConsumer waiting for first consumer to be created before binding
That event is not a failure by itself: with a StorageClass whose volumeBindingMode is WaitForFirstConsumer (the current default recommendation, since it lets the scheduler pick a zone/node before the volume is provisioned there), the PVC is expected to sit Pending until a pod that uses it is scheduled. If the pod itself is also Pending (check kubectl describe pod), the PVC will never move until the pod's own scheduling problem (node selector, taint, resource fit) is resolved first.
2. Check the StorageClass
kubectl get sc <name> -o yaml
Confirm the provisioner field names a real, currently-running Container Storage Interface (CSI, the standard plugin interface storage vendors implement) driver, and note volumeBindingMode and reclaimPolicy. A StorageClass pointing at a provisioner name with no matching CSI driver deployed in the cluster will never provision anything, and the PVC's own events are usually the first place that shows up (a "no volume plugin matched" or "provisioner not found" message).
3. List existing PVs for a manual-binding mismatch
kubectl get pv -o custom-columns=NAME:.metadata.name,SC:.spec.storageClassName,CAP:.spec.capacity.storage,MODE:.spec.volumeMode,ACCESS:.spec.accessModes,CLAIM:.spec.claimRef.name
If you're using statically pre-created PVs rather than dynamic provisioning, the common mismatches are: no PV with the same storageClassName, a PV with less capacity than requested, a volumeMode mismatch (PV is Block, PVC wants Filesystem), or a PV whose claimRef already points at a different claim.
4. Read the CSI provisioner's own logs
kubectl -n kube-system logs deploy/<csi-driver-controller-deployment> -c <provisioner-container>
(the exact deployment and container name depend on which CSI driver is installed, e.g. an EBS, Persistent Disk, or Azure Disk CSI controller; find it with kubectl get pods -n kube-system | grep csi). This is where the real, specific failure usually surfaces even when the PVC's own events are vague: a resource-exhausted error from the cloud API, an IAM/permission denial on the provisioner's own service account, or a zone mismatch between the requested volume and where the pod was scheduled.
5. Cloud-side quota and permissions
If the provisioner log shows a quota or resource-limit error, check the cloud provider's own quota view for the specific volume type in the specific region, and separately confirm the CSI controller's service account or workload identity actually has permission to create volumes (a permissions error and a quota error can produce very similar-looking provisioner log lines, so read the exact error string rather than assuming which one it is).
Trade-offs and pitfalls
WaitForFirstConsumerbinding being mistaken for a stuck PVC is the single most common false alarm in this whole flow; always check whether a pod is even trying to consume the PVC before treating Pending as broken.- Static PV/PVC binding (hand-created PVs) trades away dynamic provisioning's convenience for exact control over which underlying disk a claim binds to, at the cost of every capacity or accessMode mismatch becoming a manual matching problem instead of the provisioner's job.
- A ReadWriteMany PVC (multiple pods, multiple nodes, one volume) is not supported by most cloud block-storage CSI drivers at all; that class of "PVC never binds" is a genuine design mismatch (need a shared-filesystem storage class like a managed NFS/Filestore-backed one) rather than a transient failure to retry.
Explain the differences between a Pod, ReplicaSet, Deployment, StatefulSet, and DaemonSet in Kubernetes. For each resource, describe its primary use cases, how it manages lifecycle and scaling, how updates/rollbacks are handled, and provide concrete examples of when you'd choose each resource (stateless web service, per-node agent, stateful database, etc.).
Sample Answer
Pods are the runtime unit; everything else here is a controller deciding how many pods to run and how to replace them. A ReplicaSet just keeps N identical pods alive. A Deployment wraps a ReplicaSet with declarative rolling updates and rollback history. A StatefulSet keeps stable per-replica identity and storage for workloads that care which replica they are. A DaemonSet guarantees exactly one pod per matching node. Job and CronJob run pods to completion, once or on a schedule, rather than keeping them running indefinitely.
Comparison
| Object | Identity model | Storage | Update mechanics | Reach for it when |
|---|---|---|---|---|
| ReplicaSet | anonymous, interchangeable pods | none built in | no native rolling update | almost never directly; it is what a Deployment manages underneath |
| Deployment | anonymous | typically shared, external, or none | rolling update via surge and unavailable settings, with full revision history and rollback | stateless services: web tiers, API servers |
| StatefulSet | stable ordinal identity (pod-0, pod-1, ...) and hostname | one PersistentVolumeClaim per ordinal via volumeClaimTemplates | ordered rolling update by default, highest ordinal first | stateful systems that need to know which replica they are: databases, brokers |
| DaemonSet | one pod per matching node | node-local, if any | rolling update per node, bounded by maxUnavailable | node-level agents: log collectors, CNI (Container Network Interface) plugins, monitoring exporters |
| Job | runs to completion, tracked by completions, parallelism, backoffLimit | ephemeral | retried on failure up to backoffLimit, not a rolling concept | one-off or batch work |
| CronJob | creates a Job on a schedule | ephemeral | governed by concurrencyPolicy (Allow, Forbid, or Replace) | scheduled batch work: nightly reports, cleanup jobs |
Worked example: rolling-update arithmetic
For a Deployment with replicas: 10, maxSurge: 25%, and maxUnavailable: 25%, Kubernetes rounds surge up and unavailable down:
surge=⌈10×0.25⌉=3
unavailable=⌊10×0.25⌋=2
So at the busiest point of the rollout the Deployment can briefly run up to 13 pods (10 plus 3 surge) while guaranteeing at least 8 stay available (10 minus 2 unavailable). This asymmetric rounding is why setting surge and unavailable to the same percentage still lets the total pod count grow slightly during a rollout instead of staying flat.
DaemonSets interact with node taints in a way that is easy to miss: they commonly carry an explicit toleration for the control-plane taint (conventionally node-role.kubernetes.io/control-plane:NoSchedule) so node-level agents like a CNI plugin or kube-proxy itself still run on control-plane nodes that ordinary application pods are excluded from. That toleration is a manifest choice the DaemonSet author makes, not automatic behavior.
Trade-offs and pitfalls
- Choosing Deployment for a workload that actually needs stable identity (a small quorum service, a primary-replica database) forces the team to rebuild that identity logic in application code; StatefulSet gives it for free, at the cost of slower, ordered rollouts.
- A stuck rollout is usually a readiness-probe failure hiding behind the surge and unavailable math: if new pods never pass readiness, the Deployment can stall indefinitely partway through, with old and new pods coexisting. Check pod events and readiness status before assuming a controller bug.
- A PodDisruptionBudget set too strictly (for example,
minAvailableequal to the full replica count) can make a Deployment's own rolling update unable to proceed, because the update's own temporary unavailability trips the budget meant to protect against unrelated disruptions. - DaemonSets bypass normal replica-count thinking: adding nodes silently adds pods and cost. Forgetting a DaemonSet exists across a large node pool is a common source of untracked resource consumption.
You observe intermittent pod-to-pod connectivity failures across nodes that correlate with large packets or certain hosts. Outline a diagnostic procedure to determine whether MTU, overlay tunneling (VXLAN), or path MTU discovery issues are causing the drops, and propose fixes.
Sample Answer
Intermittent drops that correlate with packet size or specific hosts point at something breaking exactly when a packet needs to be fragmented or exceeds a link's MTU (Maximum Transmission Unit, the largest packet size a link will carry without fragmenting it). In an overlay-networked cluster this usually means one of two things: the pod-facing MTU is set too high for what the overlay's encapsulation overhead leaves available, or Path MTU Discovery (PMTUD, the mechanism that lets a sender learn the smallest MTU along a path and shrink its packets accordingly) is broken because something is blocking the ICMP message it depends on.
Diagnostic procedure
1. Reproduce the cutoff with ping and the do-not-fragment bit. Sending progressively smaller packets with the DF (do-not-fragment) flag set finds the exact size where things start working:
kubectl exec -it pod-a -- ping -M do -s 1472 pod-b-ip
The -s 1472 size is not arbitrary: a standard 1500-byte Ethernet MTU minus a 20-byte IPv4 header and an 8-byte ICMP header leaves exactly
1500−20−8=1472
bytes of payload, so this command sends the largest packet a normal, un-encapsulated 1500-byte link should be able to carry without fragmenting. If it fails at 1472 but succeeds well below that, the working link is smaller than a plain 1500-byte Ethernet MTU, pointing at overlay encapsulation eating the difference.
2. Check the overlay's actual overhead. VXLAN (Virtual Extensible LAN, the tunneling protocol most CNI, Container Network Interface, overlay networking uses to carry pod traffic across nodes) adds a fixed amount of header on top of every encapsulated packet: an outer Ethernet header, an outer IP header, an outer UDP header, and the VXLAN header itself:
14 (outer Ethernet)+20 (outer IP)+8 (outer UDP)+8 (VXLAN)=50 bytes
So on a host with a 1500-byte physical MTU, the pod-facing overlay interface has to advertise an MTU of at most
1500−50=1450
bytes, not 1500, or packets that fill a full 1500-byte pod-side MTU need fragmentation, or are dropped outright, once VXLAN wraps them. Confirm both values directly:
ip link show dev eth0 # physical/host MTU
ip link show dev vxlan0 # overlay interface MTU
If the overlay interface shows 1500 instead of 1450 on a host whose physical link is 1500, that mismatch alone explains large-packet drops without needing to look any further.
3. Capture traffic to see whether PMTUD is even getting a chance to work. When a packet is too large for a link and DF is set, a router along the path is supposed to send back an ICMP "fragmentation needed" message so the sender can shrink future packets:
tcpdump -i any icmp -w icmp.pcap
A capture that shows nothing at all on the affected flow, no ICMP error, no successful smaller retry, while large packets simply vanish, points at that ICMP message being filtered somewhere in the path (a security group, firewall, or a misconfigured NAT device dropping ICMP), which breaks PMTUD even though the MTU mismatch itself is correctly detected by the network. A capture that does show an ICMP type 3 code 4 ("fragmentation needed") message confirms PMTUD is at least attempting to work, and the investigation shifts to why the sender is not honoring it.
4. Confirm the kernel's PMTUD and MSS behavior on affected hosts.
sysctl net.ipv4.ip_no_pmtu_disc # 0 = PMTUD enabled (expected default)
sysctl net.ipv4.tcp_mtu_probing # fallback probing if PMTUD's ICMP path is blocked
Fixes, from least to most invasive
- Align the overlay MTU with reality. Set the CNI's configured MTU to host MTU minus the overlay's actual overhead, 1450 for a 1500-byte host with VXLAN, following the arithmetic above, rather than leaving it at a default that assumes no encapsulation.
- Clamp TCP's MSS (Maximum Segment Size) at the border, as a safety net. This forces TCP connections to negotiate a segment size that already accounts for the path's real MTU, so they never depend on PMTUD succeeding:
iptables -t mangle -A POSTROUTING -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
- If ICMP genuinely cannot be allowed through, a security policy that blocks it entirely, enable TCP MTU probing as a fallback so affected connections can still discover a working size without relying on the ICMP message:
sysctl -w net.ipv4.tcp_mtu_probing=1
- Longer-term, use jumbo frames on the physical network if the cloud provider or on-prem network supports a larger MTU (many cloud VPCs support jumbo frames on instances with the right networking mode, though the exact ceiling is provider- and instance-type-specific), which restores headroom for overlay overhead without shrinking the pod-facing MTU at all.
Trade-offs and pitfalls
- MSS clamping is a low-risk, immediate fix but only helps TCP; UDP-based traffic, including some service mesh data planes and certain database protocols, gets no benefit from it and still depends on a correct MTU or working PMTUD.
- Raising the physical network to jumbo frames without also raising the overlay's per-packet overhead accounting is a common half-fix: the arithmetic above still needs to subtract the overlay overhead from whatever the new physical MTU is; it does not make the overhead disappear.
- Changing a live cluster's CNI MTU setting typically requires restarting the CNI's node agent, and sometimes recreating existing pods, to pick up the new value, so treat it as a change with a blast radius, not a live config tweak.
flowchart TD
A[Large-packet drops, correlated with size/host] --> B[Ping with DF bit, decreasing size]
B -->|fails below 1500| C[Check host MTU vs overlay interface MTU]
C -->|overlay MTU too high for overhead| D[Fix: lower CNI overlay MTU]
B --> E[tcpdump for ICMP frag-needed]
E -->|ICMP present, not honored| F[Enable tcp_mtu_probing]
E -->|ICMP missing entirely| G[ICMP blocked in path: fix firewall, or clamp MSS]
Unlock Full Question Bank
Get access to all Kubernetes Architecture, Operations, and Troubleshooting interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.