▚ The Software Engineer's Field Manual
Chapter E10 · Primer + senior drill

Kubernetes — Primer + 150-Question Drill

"You have deployed to Kubernetes for years. The senior round asks what happens in the four seconds after you press enter — and why your pod died at 2 a.m. with memory usage that looked fine."

150 questions · answers collapsed For: ~9-year engineers prepping the senior round Heavy on: the control loop · probes & resources · rollouts · networking · production incidents

01 · Why this primer existsYou Ship to Kubernetes Daily — Nobody Ever Taught You Its Insides

Most backend engineers meet Kubernetes the way they meet a corporate expense system: someone hands them a YAML file, they copy it, change the image tag, and it works. Nine years later they can write a Deployment from memory and still cannot say, in order, which five programs cooperate to turn that file into a running process on a machine. Senior interviews find that gap fast. What does the scheduler actually score? Why is a Pod, not a container, the unit? What is the difference between a readiness and a liveness probe, and which one causes an outage when you get it wrong? Why did the container get OOMKilled when the dashboard said it used 60 percent of its memory? None of these are trick questions. They test whether you understand the machine that runs your code, and every one is answerable from a small set of ideas taught here in plain words: the control loop, the Pod, requests and limits, the Service, and the controller.

The page has two halves. The primer (sections 02–06) walks the internals honestly. First the control loop: what happens, step by step, when you run kubectl apply on a Deployment, and which component does each piece of the work. Second, running workloads well: resources, probes, rolling updates, graceful shutdown, disruption budgets, and autoscaling — the section where most production incidents are born. Third, networking: how a packet finds a Pod, and what Services, Ingress, the Gateway API, and network policies each contribute. Fourth, configuration, storage, and access control. Fifth, operating in production: debugging, node pressure, autoscaling the cluster itself, tenancy, cost, and the security baseline. Every chapter includes complete, applyable manifests — nothing is elided.

The drill (sections 07–10) is 150 interview questions of three kinds. Knowledge questions ask for a mechanism and a "why", never a definition. Scenario questions describe a production incident with concrete numbers, and the strong answer walks it in diagnosis order: the symptom, the evidence you would collect, the likely causes ranked, the fix, and the prevention. Design questions ask you to design a component or a migration and to say what you would deliberately not do. Use the drill the way the Database Primer and the Java Interview Drill are meant to be used: read the question, say your answer aloud as if the interviewer were in the room, and only then open Reveal answer. The saying-aloud is the practice; the reveal is just the check.

Version facts are date-stamped. As of August 2026 the newest upstream Kubernetes is 1.37 (released 26 August 2026), with 1.35 and 1.36 also in support, and the managed services — EKS, GKE, AKS — typically defaulting one or two minor versions behind that. Where a feature's graduation matters (for example the nftables kube-proxy mode, sidecar containers, or in-place Pod resize), the primer says which release made it stable. This appendix sits on top of E9 Docker (images, layers, the container runtime) and pairs with E7 Microservices and E4 Spring Boot, because most of what you will run on a cluster is a Spring Boot service talking to other Spring Boot services.

02 · The primerThe Control Loop — What Happens When You Press Enter

Start with a number. A mid-sized cluster runs 40 nodes and 1,200 Pods, and on an ordinary Tuesday about 300 of those Pods are replaced — deploys, node upgrades, autoscaling, crashes. Nobody logs in to a machine to do any of that. The reason it works is a single idea repeated everywhere in Kubernetes: declare the state you want, and let a loop make the world match it. You write "I want three copies of this container." A program watches that wish, compares it with what actually exists, and acts on the difference. If a node dies and a copy vanishes, the same loop notices "three wanted, two exist" and starts one more. Nothing special happens on failure, because failure is just another difference between wanted and actual.

The bridge to what you already know: this is a reconciliation loop, the same shape as a retrying batch job that reads a target table, reads the real system, and issues the minimal changes. You have probably written one to sync users into a third-party system. Kubernetes is a collection of about thirty such loops, each responsible for one kind of object, all reading and writing one shared store through one API.

The five programs on the control plane, and the two on every node

The control plane is the set of programs that make decisions; the nodes are the machines that run your containers. On the control plane:

On every node:

Pods, ReplicaSets, Deployments — and why the Pod is the unit

A Pod is one or more containers that share a network namespace (one IP, one set of ports, they reach each other on localhost) and can share volumes, scheduled together onto one node, and started and stopped together. The Pod is the unit of scheduling because a container is too small a unit to be useful on its own: a real workload is usually "the app container plus a log shipper plus a proxy", and those pieces must sit on the same machine, share files, and die together. Since 1.33, helper containers can be declared as sidecar containers — init containers with restartPolicy: Always — which start before the app container and stop after it, so a proxy or log shipper no longer races the main process at startup and shutdown.

Pods are disposable. A Pod is never healed or moved; if its node dies, the Pod is gone and a new Pod with a new name and a new IP is created somewhere else. That is why you rarely create Pods directly. A ReplicaSet holds a Pod template plus a number, and its controller keeps exactly that many Pods matching its label selector alive. A Deployment sits above the ReplicaSet and owns the change story: when you change the Pod template (a new image tag, a new environment variable), the Deployment controller creates a new ReplicaSet with the new template and shifts replicas from the old one to the new one, a few at a time, according to the rollout parameters in the next chapter. The old ReplicaSet stays around with zero replicas so that kubectl rollout undo can scale it back up.

Deployment: orders replicas: 3 · image: orders:2.4 ReplicaSet orders-7c9f (old) image 2.3 · wanted 3 → 0 ReplicaSet orders-b41d (new) image 2.4 · wanted 0 → 3 scale down 1 at a time scale up (maxSurge) Pod 2.3 (gone) Pod 2.3 (gone) Pod 2.3 (draining) Pod 2.4 Ready Pod 2.4 Ready Pod 2.4 starting Each layer only edits the layer below it; each has its own controller loop
Fig. E10.1 — A Deployment does not touch Pods. It scales ReplicaSets; ReplicaSets create and delete Pods. Mid-rollout, both ReplicaSets exist and the traffic is served by whichever Pods are Ready.

What happens when you kubectl apply a Deployment — step by step

Here is the sequence with the actor named at every step. Say it in this order in an interview and you have answered the most common Kubernetes architecture question there is.

  1. kubectl reads the YAML, converts it to JSON, and sends an HTTP request to the API server. With apply, it sends a server-side apply patch that records which fields this client manages, so that later changes from other tools (an autoscaler editing replicas) do not fight it.
  2. The API server authenticates you (a client certificate, a token, or an OpenID Connect identity), authorizes the verb patch on deployments in that namespace through RBAC, runs mutating admission (which may inject defaults or a sidecar), validates the schema, runs validating admission (which may reject a container running as root), and writes the Deployment object into etcd. It replies 200 to kubectl. At this moment nothing is running yet.
  3. The Deployment controller, which holds an open watch on Deployments, is notified. It compares the desired state (a template with image 2.4, three replicas) with the ReplicaSets that exist. None match the new template, so it creates a new ReplicaSet with replicas set according to maxSurge, and writes it — through the API server, into etcd.
  4. The ReplicaSet controller is notified of the new ReplicaSet. It counts matching Pods (zero) against the wanted number and creates Pod objects with the template's spec. Those Pod objects have no nodeName. They exist only as records in etcd; the status shows Pending.
  5. The scheduler is notified of unscheduled Pods. For each one it filters nodes, scores the survivors, and writes a binding that sets spec.nodeName. Still nothing is running.
  6. The kubelet on the chosen node sees a Pod assigned to it. It creates the Pod's network namespace by calling the CNI plugin (which allocates a Pod IP), asks containerd to pull the image if it is not cached, creates the cgroup with the CPU and memory limits, starts the init containers in order, then starts the app container. It begins running the startup probe, then the liveness and readiness probes.
  7. When the readiness probe passes, the kubelet marks the Pod Ready. The EndpointSlice controller sees a Ready Pod matching a Service's selector and adds its IP to that Service's EndpointSlice. kube-proxy on every node sees the new endpoint and adds it to the routing rules. Only now does traffic arrive.
  8. The Deployment controller sees the new ReplicaSet has enough available Pods, scales the old one down by one, and repeats until the old ReplicaSet is at zero. The rollout is complete.

Two things about this sequence matter in interviews. First, every arrow goes through the API server and etcd; the components never talk to each other directly. That is what makes the system resilient to any single component restarting: it just re-reads the state and continues. Second, each step is a separate loop with a separate failure mode, which is why a Pod that stays Pending is a scheduler question, a Pod stuck in ContainerCreating is a kubelet or CNI or image question, and a Pod that is running but receives no traffic is a readiness or endpoint question. Diagnosing means locating which loop stopped making progress.

API server + etcd the only shared state · watches fan out 1 · kubectl apply 3–4 · controllers Deployment, ReplicaSet 5 · scheduler sets spec.nodeName 6 · kubelet (node) CNI → pull → cgroup → start 7 · EndpointSlice ctrl Ready Pod → Service endpoints 7 · kube-proxy / eBPF programs routing rules write Deployment watch · write RS, Pods watch Pods for me · report status watch EndpointSlices No component calls another directly — each one watches the store and acts on differences
Fig. E10.2 — The hub-and-spoke shape of the control plane. Numbered boxes follow the step-by-step walkthrough above: every actor reads from and writes to the API server, and the watch mechanism turns one write into the next actor's wake-up.

A complete Deployment, the way you should actually write one

The manifest below is the reference Deployment for the rest of this page: a Spring Boot service with a startup probe, separate readiness and liveness probes, resource requests and limits, a graceful-shutdown hook, spread across zones, and running as a non-root user. Every field in it is explained in the next chapter. Apply it with kubectl apply -f orders-deployment.yaml; it only needs a namespace called shop and an image you can pull.

Step-by-step: what orders-deployment.yaml does, in plain English
  1. apiVersion, kind, and metadata identify the object: a Deployment named orders in the shop namespace, with labels that the Service and the monitoring stack will select on.
  2. replicas: 3 is the desired count. The selector must match the Pod template's labels — that is how the ReplicaSet finds its own Pods.
  3. strategy sets the rollout rules: at most one extra Pod above three during a rollout (maxSurge: 1) and never fewer than three Ready (maxUnavailable: 0), so capacity never dips.
  4. The Pod template's securityContext runs the process as user 10001, forbids privilege escalation, and makes the root filesystem read-only, with a writable emptyDir mounted at /tmp for the JVM.
  5. terminationGracePeriodSeconds: 45 gives the process up to 45 seconds after SIGTERM before it is killed; the preStop sleep of 5 seconds lets routing rules drain before the shutdown starts.
  6. topologySpreadConstraints asks the scheduler to spread the three Pods across availability zones as evenly as possible, and refuses to schedule if it cannot.
  7. The container's resources reserve 500 millicores and 1 GiB for scheduling and cap memory at 1 GiB — a memory limit equal to the request is the deliberate choice, explained in the next chapter. There is no CPU limit, also deliberate.
  8. The JAVA_TOOL_OPTIONS environment variable tells the JVM to size its heap as a percentage of the container's memory limit, and to exit fast if it runs out of heap.
  9. The startupProbe polls the Spring Boot actuator liveness endpoint up to 30 times, 5 seconds apart, so the JVM has 150 seconds to start before the other probes begin.
  10. The readinessProbe asks the actuator readiness endpoint every 5 seconds; two failures remove the Pod from Service endpoints without restarting it.
  11. The livenessProbe asks the actuator liveness endpoint every 10 seconds; three failures in a row restart the container.
orders-deployment.yamlruns offline
apiVersion: apps/v1
kind: Deployment
metadata:
  name: orders
  namespace: shop
  labels:
    app.kubernetes.io/name: orders
    app.kubernetes.io/part-of: shop
spec:
  replicas: 3
  revisionHistoryLimit: 5
  selector:
    matchLabels:
      app.kubernetes.io/name: orders
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app.kubernetes.io/name: orders
        app.kubernetes.io/part-of: shop
    spec:
      serviceAccountName: orders
      terminationGracePeriodSeconds: 45
      securityContext:
        runAsNonRoot: true
        runAsUser: 10001
        runAsGroup: 10001
        fsGroup: 10001
        seccompProfile:
          type: RuntimeDefault
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: topology.kubernetes.io/zone
          whenUnsatisfiable: DoNotSchedule
          labelSelector:
            matchLabels:
              app.kubernetes.io/name: orders
      containers:
        - name: orders
          image: registry.example.com/shop/orders:2.4.0
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8080
          env:
            - name: JAVA_TOOL_OPTIONS
              value: "-XX:MaxRAMPercentage=70 -XX:+ExitOnOutOfMemoryError -Dserver.shutdown=graceful -Dspring.lifecycle.timeout-per-shutdown-phase=30s"
            - name: SPRING_PROFILES_ACTIVE
              value: "prod"
          resources:
            requests:
              cpu: "500m"
              memory: "1Gi"
            limits:
              memory: "1Gi"
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop: ["ALL"]
          volumeMounts:
            - name: tmp
              mountPath: /tmp
          startupProbe:
            httpGet:
              path: /actuator/health/liveness
              port: http
            periodSeconds: 5
            failureThreshold: 30
          readinessProbe:
            httpGet:
              path: /actuator/health/readiness
              port: http
            periodSeconds: 5
            failureThreshold: 2
          livenessProbe:
            httpGet:
              path: /actuator/health/liveness
              port: http
            periodSeconds: 10
            failureThreshold: 3
          lifecycle:
            preStop:
              sleep:
                seconds: 5
      volumes:
        - name: tmp
          emptyDir: {}

Watching the loop work

Apply the manifest, then watch the objects appear. The session below is what a healthy rollout looks like, with each line read for you afterwards.

terminal — kubectl apply and watch
$ kubectl apply -f orders-deployment.yaml
deployment.apps/orders created

$ kubectl get deploy,rs,pods -n shop -l app.kubernetes.io/name=orders
NAME                     READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/orders   0/3     3            0           4s

NAME                                DESIRED   CURRENT   READY   AGE
replicaset.apps/orders-6d9c7b8f4b   3         3         0       4s

NAME                          READY   STATUS              RESTARTS   AGE
pod/orders-6d9c7b8f4b-2xk9p   0/1     ContainerCreating   0          4s
pod/orders-6d9c7b8f4b-q7ztf   0/1     ContainerCreating   0          4s
pod/orders-6d9c7b8f4b-wm4lc   0/1     Pending             0          4s

$ kubectl get pods -n shop -l app.kubernetes.io/name=orders -o wide
NAME                      READY   STATUS    RESTARTS   AGE   IP            NODE
orders-6d9c7b8f4b-2xk9p   1/1     Running   0          58s   10.244.3.17   ip-10-0-1-40
orders-6d9c7b8f4b-q7ztf   1/1     Running   0          58s   10.244.7.92   ip-10-0-2-12
orders-6d9c7b8f4b-wm4lc   0/1     Running   0          58s   10.244.5.44   ip-10-0-3-77

$ kubectl rollout status deploy/orders -n shop
Waiting for deployment "orders" rollout to finish: 2 of 3 updated replicas are available...
deployment "orders" successfully rolled out

Read the output. The first get at four seconds shows the whole chain already created — the Deployment, one ReplicaSet with DESIRED 3, and three Pods — but READY 0/3, because the kubelets are still pulling the image (ContainerCreating) and one Pod has not even been placed yet (Pending: the scheduler had not written its binding at that instant, or was waiting for a node with room). At 58 seconds, all three are Running, and the -o wide columns show the two things you always want to know: each Pod's IP (from the 10.244.0.0/16 Pod network) and which node it landed on — three different nodes, as the spread constraint asked. The third Pod is Running but 0/1 READY: its process is up, but its readiness probe has not yet passed, so it is not in the Service's endpoints and receives no traffic. rollout status blocks until the Deployment reports all replicas available, which is what your CI pipeline should wait on before declaring a deploy done.

🧠 Brain power

Before reading on: the controller manager crashes and stays down for ten minutes. During those ten minutes, a node dies, taking one of the three orders Pods with it. What does a user see, what does kubectl get pods show, and what happens when the controller manager comes back?

Reveal the answer

Users are mostly fine: the two surviving Pods keep serving, because serving traffic does not involve the control plane at all — kube-proxy rules on every node already point at the two live Pod IPs. The dead Pod's IP stays in the endpoints for a while, so a fraction of connections time out until the node is marked unhealthy; the Node controller (also inside the crashed controller manager) is the one that would have marked it, so that cleanup is delayed too. kubectl get pods keeps showing three Pods, the dead one as Running with a stale status, because nothing is updating it. When the controller manager restarts, it re-lists every object, the Node controller marks the node NotReady and evicts its Pods, and the ReplicaSet controller counts two matching Pods against a wanted three and creates the third. Nothing is lost, only delayed — the desired state was in etcd all along.

03 · The primerRunning Workloads Well — Resources, Probes, Rollouts, Shutdown

Here is a number from a real postmortem shape you will recognise. A payments service ran for a year with a memory limit of 2 GiB and a dashboard that showed "memory: 1.2 GiB used, 60 percent". One Thursday the Pods began dying with OOMKilled every few hours. Nothing had been deployed. The dashboard was telling the truth about the JVM heap and was completely silent about what the kernel counts: heap plus metaspace plus thread stacks plus direct buffers plus the page cache charged to the container. The kernel's number crossed 2 GiB; the kernel killed the process. Every idea in this chapter is one of those gaps between what the application thinks and what the cluster enforces.

The bridge: you have tuned a JVM with -Xmx and a thread pool with a maximum size. Kubernetes resource management is the same conversation, held with the Linux kernel instead of the JVM, and the vocabulary is requests and limits.

Requests versus limits — and why CPU and memory behave differently

A request is the amount the scheduler reserves for the container when it picks a node. A node with 8 CPUs and 32 GiB can hold Pods whose requests add up to at most that (minus what the system reserves). Requests are a scheduling promise: the sum never exceeds the node. A limit is the amount the kernel will enforce at runtime, through a cgroup — the Linux mechanism that meters and caps a group of processes. The two resources are enforced in completely different ways:

That last point is the Quality of Service class, which the kubelet assigns from your requests and limits. Guaranteed: every container has requests equal to limits for both CPU and memory. Burstable: at least one request or limit is set, but they are not all equal. BestEffort: nothing set at all. When a node runs out of memory, the kubelet evicts BestEffort Pods first, then Burstable Pods that are using more than they requested, and Guaranteed Pods last. The practical recommendation that follows for a JVM service: set the memory request equal to the memory limit (so the reservation matches what can actually be used and the Pod is never evicted for "using more than it asked for"), set a CPU request that reflects steady-state usage, and do not set a CPU limit unless you have a multi-tenant reason to, because throttling a JVM hurts latency more than sharing spare CPU helps anyone. The reference manifest above follows exactly this pattern.

Resource settings: what each one controls and what goes wrong when it is missing or wrong.
SettingUsed byWhen it is too lowWhen it is too highRecommended for a JVM service
CPU requestScheduler (placement), kernel (weight under contention)Pod lands on a full node and starves when neighbours are busyCluster looks full; Pending Pods while nodes idleSteady-state usage measured over a week, roughly the p50
CPU limitKernel CFS quota (throttling)Latency spikes, slow startup, GC pauses lengthen, throttling metric climbsMostly harmless; only matters when sharedUsually omit; if required, at least 2× the request
Memory requestScheduler, eviction orderingNode overcommits; Pod evicted first under node pressureWasted reservation, Pending PodsEqual to the limit
Memory limitKernel cgroup (OOM kill)OOMKilled restarts, often at traffic peaksFewer Pods per node, higher costHeap ÷ 0.70, rounded up, plus headroom for off-heap

Since Kubernetes 1.33, the in-place Pod resize feature (beta, enabled by default) lets you change a running Pod's CPU and memory requests and limits without restarting it, subject to the container runtime and the node having room. Before that, any resource change meant a rolling restart. It is worth knowing because interviewers who track releases ask about it; it does not change the advice above.

The JVM inside the container: sizing that does not lie

A JVM reads the cgroup limit and, by default, sizes its maximum heap at one quarter of it — a 1 GiB limit gives a 256 MiB heap, which is why so many "Kubernetes made my app slow" stories are really "the heap was tiny". Set -XX:MaxRAMPercentage explicitly. The snippet below is the resource block plus JVM flags used in the reference Deployment, isolated so you can lift it into any Spring Boot manifest.

Step-by-step: what jvm-resources.yaml does, in plain English
  1. The memory request and limit are both 1.5 GiB, so the Pod is in the Guaranteed class for memory and is never evicted for over-use.
  2. The CPU request is 1 full core so that startup (class loading and JIT compilation are CPU-hungry) is not starved; there is no CPU limit, so the JVM can borrow idle cores.
  3. MaxRAMPercentage=70 makes the maximum heap about 1,075 MiB, leaving roughly 460 MiB for metaspace, threads, code cache, direct buffers, and the container's page cache.
  4. ExitOnOutOfMemoryError makes the JVM die immediately on a heap exhaustion instead of limping along with a half-broken application; the kubelet restarts it, and the restart count becomes the alert.
  5. ActiveProcessorCount=2 tells the JVM to size its garbage collector and common thread pools for two cores rather than the node's 32, which otherwise creates hundreds of idle threads and unpredictable pause behaviour when there is no CPU limit.
jvm-resources.yaml (container fragment, drop into any Deployment)runs offline
resources:
  requests:
    cpu: "1"
    memory: "1536Mi"
  limits:
    memory: "1536Mi"
env:
  - name: JAVA_TOOL_OPTIONS
    value: "-XX:MaxRAMPercentage=70 -XX:+ExitOnOutOfMemoryError -XX:ActiveProcessorCount=2 -XX:+UseG1GC"

Three probes, three different questions

A probe is a check the kubelet runs against the container on a schedule: an HTTP GET, a TCP connect, a gRPC health call, or a command. There are three, and confusing them is the single most common cause of self-inflicted Kubernetes outages.

The rule of thumb to say aloud: readiness may depend on dependencies; liveness may depend only on the process itself. Spring Boot's actuator separates them for exactly this reason — the liveness group is the application context being alive, the readiness group is "ready to serve" and includes anything you register there.

Rolling updates: the two numbers that decide whether deploys drop requests

A Deployment's RollingUpdate strategy has two knobs. maxSurge is how many Pods above the desired count may exist during the rollout (a number or a percentage). maxUnavailable is how many Pods below the desired count may be not-Ready at any time. The defaults are 25 percent each. For three replicas that rounds to maxSurge 1 and maxUnavailable 0 (percentages for unavailable round down, for surge round up) — but for ten replicas it means up to 2 Pods can be out of service at once, which is a 20 percent capacity dip you did not ask for. The setting that never dips capacity is maxUnavailable: 0 with maxSurge: 1 or more, at the cost of temporarily needing room for one extra Pod. With minReadySeconds you can additionally require a new Pod to stay Ready for some seconds before it counts, which catches "passes the probe, then crashes at the first real request".

Graceful termination — the sequence that decides your error rate during deploys

When a Pod is deleted (rollout, scale-down, node drain), two things happen at the same time, and the race between them is why deploys drop requests. Path one: the API server marks the Pod as terminating, the EndpointSlice controller removes its IP from the Service, and kube-proxy on every node — dozens or hundreds of them — updates its rules. That propagation takes anywhere from a few hundred milliseconds to several seconds. Path two: the kubelet on the Pod's node runs the preStop hook if there is one, then sends SIGTERM to the container's main process, waits up to terminationGracePeriodSeconds, then sends SIGKILL. If the process stops accepting connections the instant it receives SIGTERM, but a node on the far side of the cluster is still routing to it for another two seconds, those requests get connection refused. That is the "rolling update drops 2 percent of requests" incident.

time t = 0 delete t = 5 s t = 35 s t = 45 s SIGKILL Path 1 · control plane remove endpoint kube-proxy rules converge Path 2 · kubelet on the node preStop sleep 5 s SIGTERM → finish in-flight requests, close pools, exit 0 unused grace The sleep exists so that no new connection arrives after SIGTERM — the two paths are otherwise unsynchronised
Fig. E10.3 — Termination timeline for the reference Deployment. Endpoint removal and process shutdown start at the same instant; the 5-second preStop sleep covers the routing-convergence window, then the application has up to 40 seconds to drain.

The fix is a three-part contract. First, a preStop sleep of a few seconds (the built-in sleep action has been stable since 1.30) so the process keeps serving while endpoints drain. Second, the application handles SIGTERM by finishing in-flight requests and then exiting — Spring Boot does this with server.shutdown=graceful plus a phase timeout. Third, terminationGracePeriodSeconds is larger than the sleep plus the longest request you are willing to wait for. Get any of the three wrong and you drop requests: no sleep and you refuse connections that are still being routed; no graceful handler and SIGTERM kills mid-request; a grace period shorter than the sleep plus the drain and SIGKILL arrives while requests are in flight.

PodDisruptionBudgets — the rule that makes node drains safe

A voluntary disruption is a Pod deletion the cluster chooses to do: a node drain for an upgrade, the cluster autoscaler removing a node, a descheduler rebalancing. A PodDisruptionBudget (PDB) tells the eviction API how many Pods of a set must remain: minAvailable: 2 or maxUnavailable: 1. A drain that would violate the budget waits. A PDB does not protect against involuntary disruptions (a node dying, an OOM kill), and a PDB that can never be satisfied (minAvailable equal to replicas, or a Pod that is never Ready) will block node upgrades forever — which is the "cluster upgrade has been stuck for six hours" incident.

Step-by-step: what orders-pdb.yaml does, in plain English
  1. Declares a PodDisruptionBudget named orders in the shop namespace.
  2. The selector picks the same Pods as the Deployment, using the same label.
  3. maxUnavailable: 1 allows one Pod at a time to be evicted voluntarily; with three replicas, a drain can never take the service below two.
  4. unhealthyPodEvictionPolicy: AlwaysAllow lets Pods that are already not-Ready be evicted freely, so a crash-looping Pod does not wedge a node upgrade.
orders-pdb.yamlruns offline
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: orders
  namespace: shop
spec:
  maxUnavailable: 1
  unhealthyPodEvictionPolicy: AlwaysAllow
  selector:
    matchLabels:
      app.kubernetes.io/name: orders

The HorizontalPodAutoscaler — what it reads and how it decides

The HorizontalPodAutoscaler (HPA) is a controller that adjusts a Deployment's replicas to keep a metric near a target. Every 15 seconds it reads the metric for every Pod, computes desired replicas = ceiling(current replicas × current metric ÷ target metric), and applies it within minReplicas and maxReplicas. Three facts an interviewer expects. First, the built-in metric is CPU utilisation as a percentage of the CPU request, served by metrics-server — so an HPA on a Deployment without CPU requests does nothing, and a high request makes the HPA lazy. Second, it can use custom metrics (requests per second from Prometheus through an adapter, queue depth) and external metrics (a cloud queue length), which are almost always better targets for a web service than CPU. Third, scale-down is deliberately slow: a five-minute stabilisation window by default, so a brief dip does not throw away capacity, and you can tune both directions with behavior. As of 1.37, scaling to zero replicas is a beta feature enabled by default. Since the HPA takes over replicas, do not also set replicas in the Deployment you apply from CI, or every deploy will reset the count.

Step-by-step: what orders-hpa.yaml does, in plain English
  1. Targets the orders Deployment with scaleTargetRef, and bounds replicas between 3 and 20.
  2. The first metric is CPU utilisation with a 65 percent target of the request, leaving headroom below the point where the JVM's latency starts to climb.
  3. The second metric is a per-Pod custom metric, http_requests_per_second, served by a Prometheus adapter, with a target of 200 per Pod. The HPA uses whichever metric asks for more replicas.
  4. The behavior block lets scale-up add 100 percent of current replicas every 30 seconds with no stabilisation delay (bursts are handled fast), and lets scale-down remove at most 20 percent every 60 seconds after a 5-minute quiet window.
orders-hpa.yamlruns offline
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: orders
  namespace: shop
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: orders
  minReplicas: 3
  maxReplicas: 20
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 65
    - type: Pods
      pods:
        metric:
          name: http_requests_per_second
        target:
          type: AverageValue
          averageValue: "200"
  behavior:
    scaleUp:
      stabilizationWindowSeconds: 0
      policies:
        - type: Percent
          value: 100
          periodSeconds: 30
    scaleDown:
      stabilizationWindowSeconds: 300
      policies:
        - type: Percent
          value: 20
          periodSeconds: 60

The other workload kinds, in one paragraph each

A StatefulSet is for Pods that need a stable identity: each Pod gets an ordinal name (db-0, db-1), its own PersistentVolumeClaim that follows it across reschedules, a stable DNS name through a headless Service, and ordered start-up and shutdown. Use it for databases, Kafka brokers, anything where "which one am I" matters. A DaemonSet runs exactly one Pod on every node (or every node matching a selector) — log shippers, node monitoring agents, the CNI plugin itself. A Job runs Pods to completion, with completions, parallelism, a backoffLimit for retries, and ttlSecondsAfterFinished so finished Jobs do not pile up. A CronJob creates Jobs on a schedule, and its two important fields are concurrencyPolicy: Forbid (do not start a new run while the last one is still going) and startingDeadlineSeconds (how late a missed run may start). Since 1.31 Jobs also support success and failure policies that let you say "stop retrying on exit code 3" rather than burning the whole backoff.

There are no dumb questions

If the readiness probe fails, does Kubernetes restart the Pod?
No. Readiness only removes the Pod from Service endpoints; the process keeps running and the probe keeps polling. When it passes again, the Pod is added back. Only the liveness probe restarts a container. This is why a readiness probe is safe to make dependency-aware and a liveness probe is not.
Why would I ever leave the CPU limit off? Is that not dangerous?
A CPU limit does not prevent a neighbour from being starved — the CPU request does that, through the kernel's weighting. A limit only prevents your container from using CPU that would otherwise sit idle. For a latency-sensitive JVM, that idle CPU is exactly what absorbs a garbage-collection pause or a startup burst. The one honest reason for a CPU limit is predictability in a hard multi-tenant cluster, where you want a workload to behave the same on a busy node as on an empty one.
My Pod says OOMKilled but the JVM never threw OutOfMemoryError. How?
Two different killers. The JVM throws OutOfMemoryError when the heap is full. The Linux kernel kills the process when the cgroup's total — heap, metaspace, thread stacks, native buffers, and page cache charged to the container — hits the limit. A JVM with a 700 MiB heap in a 1 GiB container can easily use 1 GiB in total and be killed with a heap that was never full. That is why the heap is sized as a percentage of the limit, not the whole of it.
Can I have zero-downtime deploys with one replica?
Yes, with maxSurge: 1 and maxUnavailable: 0: the Deployment starts the new Pod, waits until it is Ready, and only then terminates the old one. You need room on the cluster for two Pods during the switch, and the graceful-termination contract must be correct, but the replica count itself is not the obstacle.

04 · The primerNetworking — How a Packet Finds a Pod

A cluster of 40 nodes and 1,200 Pods has 1,200 Pod IPs, and about 300 of them change every day. Nothing in your application configuration mentions any of them, and yet a request to http://orders.shop.svc.cluster.local reaches a healthy Pod within about a millisecond. Four mechanisms make that true — the flat Pod network, the Service, kube-proxy, and cluster DNS — and each one is a place things fail in a distinctive way.

The bridge: you already know the shape from a load balancer in front of a fleet of virtual machines, with a DNS name pointing at the load balancer and a health check deciding membership. Kubernetes has the same three pieces; the difference is that the "load balancer" is not a box but a set of packet-rewriting rules installed on every node, and membership is driven by the readiness probe.

The network model: every Pod has a routable IP, no NAT inside the cluster

The Kubernetes network model is one rule with three consequences. The rule: every Pod gets its own IP address, and any Pod can reach any other Pod's IP directly, across nodes, without address translation. The consequences: containers in a Pod share that IP (they talk on localhost and must not fight over ports), Pods see each other's real source IPs, and the application never has to know about port mapping the way it does with plain Docker (compare E9, where publishing a port means a NAT rule on the host). Delivering that rule is the job of the CNI plugin — the Container Network Interface implementation installed on every node: Cilium, Calico, or the cloud's own plugin (the AWS VPC CNI hands Pods real VPC addresses). When the kubelet creates a Pod's network namespace, it calls the CNI plugin, which allocates an IP from the node's range and wires up the routes.

Services: a stable name and IP for a changing set of Pods

A Service is an object with a label selector and a stable virtual IP called the ClusterIP. The EndpointSlice controller keeps a list — the EndpointSlices — of the IPs of Ready Pods matching the selector. Nothing listens on the ClusterIP; it is a number that exists only in routing rules. There are four Service types, and they nest:

A headless Service (clusterIP: None) has no virtual IP; DNS returns the Pod IPs directly. StatefulSets use it so that db-0.db.shop.svc.cluster.local resolves to exactly that Pod.

How kube-proxy actually routes: iptables, IPVS, nftables, and eBPF

When a Pod sends a packet to a ClusterIP, something on the sending node must rewrite the destination to a real Pod IP. That is kube-proxy's job, and it does it by programming the kernel, not by handling packets itself. In iptables mode, it writes NAT rules: "for destination 10.96.12.5:80, with probability 1/3 rewrite to 10.244.3.17:8080, else with probability 1/2 to 10.244.7.92:8080, else to 10.244.5.44:8080". Those rules are evaluated linearly, and a cluster with 5,000 Services generates tens of thousands of rules, which is where iptables mode hits its wall: rule updates take seconds, and every new connection walks a long chain. IPVS mode uses the kernel's in-kernel load balancer with hash-table lookup and real balancing algorithms (round-robin, least-connection). nftables mode, stable since 1.33 and the direction the project is moving in (1.37 continues the shift away from IPVS), uses the newer kernel packet-filtering framework with map lookups instead of linear chains. And on clusters running Cilium, kube-proxy is replaced entirely by eBPF programs — small verified programs attached to the kernel's networking hooks — that do the Service lookup in a hash map at the socket level, so the rewrite happens at connect() time and the packet never carries the ClusterIP at all.

The fact that matters for debugging: the choice of backend is made per new connection, on the client's node. An established TCP connection stays pinned to one Pod for its lifetime. That is why a Java HTTP client with a keep-alive pool can send 100 percent of its traffic to one Pod for an hour while the other four sit idle — the Service "load-balanced" once, at connect time, and never again. It is also why removing a Pod from endpoints does not cut its existing connections; only the process closing them does.

Node A checkout Pod 10.244.1.9 connect 10.96.12.5:80 kernel rules (kube-proxy / eBPF) DNAT → pick one endpoint, 1/3 each Node B · orders Pod 10.244.3.17:8080 · Ready Node C · orders Pod 10.244.7.92:8080 · Ready Node D · orders Pod 10.244.5.44:8080 · NOT Ready (removed from EndpointSlice) rewritten dst 10.244.3.17:8080 The ClusterIP 10.96.12.5 never appears on the wire — it is rewritten on the sender's node
Fig. E10.4 — Service routing. The choice is made once per new connection on the client's own node from the current EndpointSlice; a Pod whose readiness probe fails simply disappears from the rule set.

DNS: how a name becomes a ClusterIP

CoreDNS runs as a Deployment in kube-system and watches Services and EndpointSlices. Every Service gets the name <service>.<namespace>.svc.cluster.local, resolving to its ClusterIP. Every Pod's /etc/resolv.conf points at the CoreDNS Service and lists search domains (shop.svc.cluster.local, svc.cluster.local, cluster.local) so that a bare orders resolves from inside the same namespace. Two operational facts. The search list combined with the default ndots:5 setting means a lookup for an external name like api.stripe.com tries api.stripe.com.shop.svc.cluster.local and every other search suffix first — four failed queries before the real one — which is why "DNS is slow in the cluster" is often fixed by a trailing dot (api.stripe.com.) or a lower ndots. And CoreDNS is a normal Deployment: under-replicated CoreDNS is a common cause of intermittent 5-second timeouts across an entire cluster; NodeLocal DNSCache — a DaemonSet that caches on each node — is the standard cure.

Ingress versus the Gateway API

An Ingress is an object that says "HTTP requests for host shop.example.com with path prefix /orders go to Service orders port 80". It does nothing by itself; an Ingress controller (ingress-nginx, Traefik, the cloud's own) watches Ingress objects and configures a proxy behind a single LoadBalancer Service. Ingress has been stable since 1.19 and is frozen: it covers HTTP host and path routing and TLS termination, and everything else (header matching, traffic splitting, timeouts) lives in controller-specific annotations that do not port between controllers.

The Gateway API is its successor, a separate set of CRDs (GA at v1.0 since late 2023 and now at v1.3 or later as of 2026), with a role split baked in. A cluster operator creates a GatewayClass (which implementation) and a Gateway (a listener with an address, ports, and TLS certificates). Application teams create HTTPRoute objects in their own namespaces that attach to the Gateway and describe matching and routing — including header matches, weighted traffic splits for canaries, and request mirroring — in a portable schema. ingress-nginx reached the end of its maintenance in March 2026; new work should target the Gateway API, with the Ingress object kept only where a controller you cannot replace demands it. The reference manifest below is an HTTPRoute.

Step-by-step: what orders-service-route.yaml does, in plain English
  1. The first document is a ClusterIP Service named orders: it selects the Deployment's Pods and maps Service port 80 to the container's named port http (8080). Nothing outside the cluster can reach it.
  2. The second document is an HTTPRoute in the shop namespace. parentRefs attaches it to a Gateway called public living in the infra namespace — the platform team's shared entry point.
  3. hostnames restricts the route to requests for shop.example.com.
  4. The first rule matches path prefix /orders and sends 90 percent of matching requests to the stable Service and 10 percent to a canary Service — a weighted split with no controller-specific annotations.
  5. The timeouts field caps the whole request at 10 seconds at the gateway, so a slow backend cannot hold gateway connections open indefinitely.
orders-service-route.yamlruns offline
apiVersion: v1
kind: Service
metadata:
  name: orders
  namespace: shop
  labels:
    app.kubernetes.io/name: orders
spec:
  type: ClusterIP
  selector:
    app.kubernetes.io/name: orders
  ports:
    - name: http
      port: 80
      targetPort: http
      protocol: TCP
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: orders
  namespace: shop
spec:
  parentRefs:
    - name: public
      namespace: infra
  hostnames:
    - "shop.example.com"
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /orders
      backendRefs:
        - name: orders
          port: 80
          weight: 90
        - name: orders-canary
          port: 80
          weight: 10
      timeouts:
        request: 10s

NetworkPolicies: the firewall you have to opt into

By default, every Pod can talk to every other Pod in the cluster, across all namespaces. A NetworkPolicy selects a set of Pods and lists what traffic they may receive (ingress) and send (egress); once any policy selects a Pod, everything not explicitly allowed in that direction is denied. Policies are enforced by the CNI plugin, not by Kubernetes itself — on a CNI that does not implement them (some default cloud plugins), the objects are accepted and silently do nothing, which is a fact worth stating in an interview. The standard baseline for a namespace is a default-deny policy plus specific allows, and the policy below is the one for the reference service.

Step-by-step: what orders-netpol.yaml does, in plain English
  1. Selects the orders Pods in shop and declares that both ingress and egress are governed by this policy — anything not listed is now denied.
  2. Ingress rule one allows traffic on port 8080 from Pods in the infra namespace that carry the gateway label — the entry proxy.
  3. Ingress rule two allows port 8080 from Pods labelled checkout in the same namespace — the one internal caller.
  4. Egress rule one allows UDP and TCP port 53 to the CoreDNS Pods in kube-system; without this, the Pod cannot resolve any name, which is the classic "I added a policy and everything broke" mistake.
  5. Egress rule two allows TCP 5432 to the Pods labelled postgres in the data namespace.
  6. Egress rule three allows TCP 443 to any address outside the Pod and Service ranges — the payment provider's API — using an IP block with the private ranges excluded.
orders-netpol.yamlruns offline
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: orders
  namespace: shop
spec:
  podSelector:
    matchLabels:
      app.kubernetes.io/name: orders
  policyTypes: ["Ingress", "Egress"]
  ingress:
    - from:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: infra
          podSelector:
            matchLabels:
              gateway.networking.k8s.io/gateway-name: public
      ports:
        - protocol: TCP
          port: 8080
    - from:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: checkout
      ports:
        - protocol: TCP
          port: 8080
  egress:
    - to:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: kube-system
          podSelector:
            matchLabels:
              k8s-app: kube-dns
      ports:
        - protocol: UDP
          port: 53
        - protocol: TCP
          port: 53
    - to:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: data
          podSelector:
            matchLabels:
              app.kubernetes.io/name: postgres
      ports:
        - protocol: TCP
          port: 5432
    - to:
        - ipBlock:
            cidr: 0.0.0.0/0
            except:
              - 10.0.0.0/8
              - 172.16.0.0/12
              - 192.168.0.0/16
      ports:
        - protocol: TCP
          port: 443

Service meshes, in plain words

A service mesh (Istio, Linkerd, or Cilium's mesh mode) puts a proxy next to every Pod — as a sidecar container, or since Istio's ambient mode as a per-node agent — and routes all Pod-to-Pod traffic through those proxies. In exchange for that extra hop and the memory of a proxy per Pod, you get three things without touching application code: mutual TLS between every pair of services (each side proves its identity with a certificate the mesh issues and rotates), uniform telemetry (latency, error rate, and traces for every call), and traffic policy (retries, timeouts, circuit breaking, canary splits) declared as objects. The honest trade-off to state: a mesh adds one to two milliseconds per hop, a few hundred megabytes per node, and a large new operational surface; for a shop with 20 services and a good HTTP client library, most of the benefit is available more cheaply from the Gateway API plus OpenTelemetry in the application (see E7 Microservices). For 200 services across teams with a compliance requirement for encryption in transit, the mesh earns its cost.

Exposing a service: choose the mechanism by who needs to reach it and what routing you need.
NeedChooseWhyDo not choose
Internal service-to-service callClusterIP Service + DNS nameFree, stable, readiness-driven membershipNodePort — exposes every node and bypasses the readiness contract for external callers
Many HTTP services behind one public address, host/path routing, canariesGateway + HTTPRoute (one LoadBalancer)Portable schema, per-team routes, weighted splits without annotationsOne LoadBalancer Service per app — cost and address sprawl
Non-HTTP TCP service exposed externally (a Kafka broker, a game server)LoadBalancer Service, or a Gateway TCPRouteLayer-4 passthrough with a stable external addressIngress — it is HTTP-only
Stable per-Pod addresses (leader election, sharded stores)Headless Service + StatefulSetDNS returns Pod IPs; each ordinal has its own nameClusterIP — it hides which Pod you reached
Mutual TLS and per-call telemetry across hundreds of services, no code changesService meshIdentity and observability at the platform layerA mesh for 15 services owned by one team — the cost outweighs the benefit

05 · The primerConfiguration, Storage & Access — The Parts Around the Container

A number to start: in a typical audit of a 200-service cluster, roughly a third of the Secrets are readable by every developer in the company, because the platform team granted get secrets at the cluster scope in 2021 "temporarily". Nobody meant it. Kubernetes gives you good tools for configuration, storage, and access control; it also makes the sloppy version very easy. This chapter covers what each object is, what it is not, and the production pattern that has settled around each.

The bridge: you have used Spring profiles, environment variables, a vault, and a file server. Each has a Kubernetes-shaped counterpart, and the useful mental move is to ask, for each one, "where does this actually live, and who can read it?"

ConfigMaps and Secrets — and why a Secret is not secret by default

A ConfigMap is a key-value object for non-sensitive configuration, up to 1 MiB, consumed by a Pod either as environment variables or as files in a mounted volume. A Secret has the same shape and the same two consumption paths, with values base64-encoded in the object. Base64 is an encoding, not encryption: anyone who can get the Secret can read the value with one command. By default, Secrets sit in etcd as plain records, and the API server can be configured for encryption at rest (an EncryptionConfiguration with a KMS provider) — which managed services do for you, but which many self-hosted clusters never enabled. What actually protects a Secret is RBAC, covered below, and the fact that the kubelet only fetches a Secret to a node when a Pod there needs it.

The pattern that has won in production is to keep the source of truth outside the cluster — AWS Secrets Manager, HashiCorp Vault, Google Secret Manager — and sync it in. The External Secrets Operator reads an ExternalSecret object that says "make a Kubernetes Secret named orders-db from these keys in that store", keeps it refreshed, and the Pod consumes an ordinary Secret. The Secrets Store CSI driver instead mounts values straight from the store as files, never creating a Kubernetes Secret at all. Both mean rotation happens in the store and flows in; neither requires a password in Git. Two consumption details worth saying aloud: a Secret mounted as a volume updates in the running Pod within about a minute when the object changes (Spring can watch the file); a Secret injected as an environment variable is fixed at container start, and only a restart picks up a new value.

Step-by-step: what orders-config.yaml does, in plain English
  1. The ConfigMap orders-config holds a whole application-prod.yaml as one key, so the file is mounted verbatim where Spring Boot will find it.
  2. The ExternalSecret asks the External Secrets Operator to build a Kubernetes Secret named orders-db from two keys in the cluster-wide store called aws-secrets, and to refresh it every hour.
  3. The Pod fragment mounts the ConfigMap as a directory under /config and the database Secret as files under /secrets/db, and tells Spring to import that directory as configuration.
  4. Both volumes are read-only, and the Secret volume uses a restrictive file mode so only the container's user can read it.
orders-config.yamlruns offline
apiVersion: v1
kind: ConfigMap
metadata:
  name: orders-config
  namespace: shop
data:
  application-prod.yaml: |
    server:
      shutdown: graceful
    spring:
      datasource:
        url: jdbc:postgresql://postgres.data.svc.cluster.local:5432/orders
        hikari:
          maximum-pool-size: 10
    management:
      endpoint:
        health:
          probes:
            enabled: true
      health:
        readinessstate:
          enabled: true
        livenessstate:
          enabled: true
---
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: orders-db
  namespace: shop
spec:
  refreshInterval: 1h
  secretStoreRef:
    kind: ClusterSecretStore
    name: aws-secrets
  target:
    name: orders-db
  data:
    - secretKey: username
      remoteRef:
        key: prod/shop/orders-db
        property: username
    - secretKey: password
      remoteRef:
        key: prod/shop/orders-db
        property: password
---
# Pod-template fragment: how the Deployment consumes both objects
apiVersion: v1
kind: Pod
metadata:
  name: orders-config-example
  namespace: shop
spec:
  containers:
    - name: orders
      image: registry.example.com/shop/orders:2.4.0
      env:
        - name: SPRING_CONFIG_IMPORT
          value: "optional:configtree:/secrets/db/,optional:file:/config/"
      volumeMounts:
        - name: config
          mountPath: /config
          readOnly: true
        - name: db
          mountPath: /secrets/db
          readOnly: true
  volumes:
    - name: config
      configMap:
        name: orders-config
    - name: db
      secret:
        secretName: orders-db
        defaultMode: 0400

Read the manifest for the Spring detail that trips people: configtree:/secrets/db/ turns each file in the directory into a property whose name is the filename — username and password — so the datasource picks up spring.datasource.username only if the files are named to match, or if the property is mapped in the ConfigMap. Combining a mounted file tree with Spring's config import is the cleanest way to avoid putting secrets in environment variables, which show up in kubectl describe pod, in crash dumps, and in any child process.

Volumes, PersistentVolumes, Claims, and StorageClasses

A container's filesystem is discarded when the container restarts. A volume is storage attached to the Pod, and it comes in kinds. An emptyDir is a scratch directory that lives as long as the Pod (it survives container restarts, not Pod deletion), backed by node disk or, with medium: Memory, by RAM that counts against the memory limit. ConfigMap and Secret volumes were covered above. For durable data there is a three-object dance. A PersistentVolume (PV) is a piece of real storage — a cloud disk, an NFS export — registered in the cluster. A PersistentVolumeClaim (PVC) is a request, in a namespace, for "10 GiB, read-write-once, class fast-ssd". A StorageClass names a provisioner (the cloud's CSI driver) and parameters, and turns a PVC into a PV on demand — dynamic provisioning — so nobody creates PVs by hand.

The two facts that decide designs. Access modes: ReadWriteOnce means one node at a time (a block disk), which is what cloud disks give you, so two Pods on different nodes cannot share it; ReadWriteMany needs a network filesystem (NFS, EFS, Filestore), which is slower and is the only way to share writable files across Pods. And a block disk lives in one availability zone, so a Pod using it can only be scheduled in that zone — the StorageClass's volumeBindingMode: WaitForFirstConsumer exists to delay creating the disk until the scheduler has chosen a node, so the disk is created in the right zone. The reclaimPolicy (Delete or Retain) decides whether deleting the PVC destroys the disk; for anything you care about, Retain.

Step-by-step: what fast-ssd-pvc.yaml does, in plain English
  1. The StorageClass fast-ssd uses the AWS EBS CSI provisioner to create gp3 volumes with 6,000 IOPS; a cluster on another cloud swaps the provisioner and parameters, and the PVC does not change.
  2. WaitForFirstConsumer defers disk creation until a Pod using the claim is scheduled, so the disk lands in the Pod's zone.
  3. Retain keeps the disk when the claim is deleted; allowVolumeExpansion lets you grow the claim in place later.
  4. The PVC asks for 50 GiB of that class with single-node read-write access; the Pod that references it gets a disk mounted at the path it chooses.
fast-ssd-pvc.yamlruns offline
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: fast-ssd
provisioner: ebs.csi.aws.com
parameters:
  type: gp3
  iops: "6000"
  throughput: "250"
  encrypted: "true"
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Retain
allowVolumeExpansion: true
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: reports-data
  namespace: shop
spec:
  accessModes: ["ReadWriteOnce"]
  storageClassName: fast-ssd
  resources:
    requests:
      storage: 50Gi

Namespaces, RBAC, and ServiceAccounts

A namespace is a name scope and a policy boundary: object names are unique within it, and quotas, network policies, RBAC bindings, and Pod Security admission all attach to it. It is not a security boundary on its own — a Pod in one namespace can reach a Pod in another unless a NetworkPolicy says otherwise, and can read another namespace's Secrets if RBAC allows it. ResourceQuota caps the total requests, limits, and object counts a namespace may use; LimitRange sets default requests and limits for containers that omit them, which is how you make sure nothing runs as BestEffort by accident.

RBAC — role-based access control — has four objects. A Role lists permitted verbs (get, list, watch, create, patch, delete) on resources within one namespace; a ClusterRole does the same cluster-wide or for cluster-scoped resources (nodes, namespaces). A RoleBinding grants a Role or ClusterRole to subjects (users, groups, ServiceAccounts) within one namespace; a ClusterRoleBinding grants a ClusterRole everywhere. Permissions are purely additive; there is no deny rule. A ServiceAccount is the identity a Pod runs as. Each namespace has a default one, and since 1.24 no long-lived token Secret is created for it; instead the kubelet injects a short-lived, audience-bound projected token into the Pod, rotated automatically, and only if automountServiceAccountToken is not set to false. Cloud identity (IAM roles for service accounts on EKS, Workload Identity on GKE) binds that same token to a cloud role, which is how a Pod calls S3 without any key in a Secret. The two rules to state: every workload gets its own ServiceAccount with the least role it needs, and cluster-admin is bound to a break-glass group, never to a person's daily identity.

Step-by-step: what orders-rbac.yaml does, in plain English
  1. Creates the orders ServiceAccount the Deployment references, with token automounting turned off because the application never calls the Kubernetes API.
  2. Defines a namespaced Role that allows only reading the one ConfigMap and one Secret the service uses — and nothing else — so even a compromised Pod that somehow obtained a token learns nothing new.
  3. Binds that Role to the ServiceAccount inside shop.
  4. The ResourceQuota caps the namespace at 40 CPUs and 80 GiB of requests, 100 Pods, and 5 LoadBalancer Services; the LimitRange gives any container that forgot its resources a default request and limit.
orders-rbac.yamlruns offline
apiVersion: v1
kind: ServiceAccount
metadata:
  name: orders
  namespace: shop
automountServiceAccountToken: false
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: orders-config-reader
  namespace: shop
rules:
  - apiGroups: [""]
    resources: ["configmaps"]
    resourceNames: ["orders-config"]
    verbs: ["get", "watch"]
  - apiGroups: [""]
    resources: ["secrets"]
    resourceNames: ["orders-db"]
    verbs: ["get", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: orders-config-reader
  namespace: shop
subjects:
  - kind: ServiceAccount
    name: orders
    namespace: shop
roleRef:
  kind: Role
  name: orders-config-reader
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: ResourceQuota
metadata:
  name: shop-quota
  namespace: shop
spec:
  hard:
    requests.cpu: "40"
    requests.memory: 80Gi
    limits.memory: 120Gi
    pods: "100"
    services.loadbalancers: "5"
---
apiVersion: v1
kind: LimitRange
metadata:
  name: shop-defaults
  namespace: shop
spec:
  limits:
    - type: Container
      defaultRequest:
        cpu: 100m
        memory: 256Mi
      default:
        memory: 512Mi

Admission control: the gate between "accepted" and "stored"

After authentication and authorization but before an object is written, the API server runs admission. Built-in admission plugins enforce quotas, apply LimitRange defaults, and implement Pod Security Admission, which checks each namespace's Pods against one of three Pod Security Standards — privileged (anything), baseline (no privileged containers, no host namespaces, no dangerous capabilities), and restricted (additionally non-root, seccomp profile set, all capabilities dropped, read-only where possible). The reference Deployment satisfies restricted. Beyond the built-ins there are two extension points: admission webhooks (the API server calls your HTTP service, which mutates or validates the object — this is how a mesh injects sidecars and how Kyverno and OPA Gatekeeper enforce custom policy) and, since 1.30, ValidatingAdmissionPolicy and, since 1.32 as beta, MutatingAdmissionPolicy, which express rules in the CEL expression language inside the API server itself, with no webhook to run. A representative policy: "every image must come from registry.example.com", "every Deployment must set memory limits", "no latest tags".

Helm, Kustomize, and GitOps

Nobody writes 200 services' manifests by hand. Helm packages manifests as a chart: Go templates plus a values.yaml of parameters, rendered per environment and installed as a named release with upgrade and rollback history. It is the distribution format for third-party software (Prometheus, cert-manager, ingress controllers all ship as charts) and works well for "one chart, many services" internal platforms. Kustomize, built into kubectl (kubectl apply -k), takes a base directory of plain manifests and applies overlays — patches per environment — with no templating language at all; the manifests stay valid YAML you can read and apply directly. Teams often use both: Helm to render a chart, Kustomize to patch the result.

GitOps is the operating model on top: the Git repository is the desired state, and an agent in the cluster — Argo CD or Flux — continuously reconciles the cluster to it. It is the same control loop again, one level up: the agent watches the repository, renders the Helm or Kustomize output, compares it with the live objects, and applies the difference; anything changed by hand in the cluster is reported as drift and, if you choose, reverted. CI no longer needs cluster credentials — it pushes an image and updates a tag in Git — and every change has a commit, an author, and a revert button. The design questions later in the drill assume this model.

CI pipeline build · test · push image Git: env repo tag: 2.4.0 → 2.4.1 Argo CD / Flux render · diff · apply Cluster live objects commit pull / watch apply read live drift detected → reported, or reverted to Git CI never holds cluster credentials; every change is a commit with an author and a revert
Fig. E10.5 — The GitOps loop is the Kubernetes control loop applied to the repository: Git is the desired state, the cluster is the observed state, and the agent reconciles the difference in both directions.
Packaging and delivery: choose the tool by who consumes the manifests and how much variation you need.
SituationChooseWhy
Installing third-party software (Prometheus, cert-manager, a database operator)Helm chart from the vendorIt is how they ship; values files expose the supported knobs
Your own services with a few environment differences (replicas, image tag, one URL)Kustomize base + overlaysPlain YAML, no templating language, readable diffs
Dozens of similar services that should share one opinionated shapeOne internal Helm chart, one small values file per serviceCentral place to fix probes, resources, security context for everyone
Deploying to the cluster from a pipelineGitOps agent (Argo CD or Flux) watching an environment repoNo cluster credentials in CI; drift detection; audit trail is the Git log
A one-off debugging Pod or a local kind clusterPlain kubectl apply -fNo ceremony is the right amount of ceremony
Boardroom translation

Practise this pitch — it is what a platform investment sounds like to a person who signs budgets: "Today each of our twelve teams deploys its own way, and an outage means finding the one engineer who knows that team's scripts. Moving the estate onto a shared Kubernetes platform with GitOps means every deploy is a reviewed Git commit, every rollback is one click, and the same on-call playbook works for every service. The measurable results: deploy frequency goes up, time-to-restore drops from hours to minutes because the desired state is always written down, and node autoscaling with correct resource requests typically cuts the compute bill by a quarter to a third, because we stop paying for machines sized for the peak of every team separately." The ROI frame: the cost is a platform team of three to five engineers; the return is that the other hundred engineers stop doing infrastructure by hand, plus a compute saving that on a mid-size cloud bill pays for the platform team on its own.

06 · The primerOperating in Production — Seeing, Debugging, Scaling the Cluster Itself

The number that frames this chapter: in most incident reviews on Kubernetes, the time from page to root cause is dominated not by the fix but by finding which layer is unhappy. A slow checkout can be a Pod being throttled, a node under memory pressure evicting its neighbours, CoreDNS under-replicated, a HikariCP pool exhausted because the database's own Pod moved, or the cluster autoscaler failing to add a node because the cloud account hit a quota. A senior engineer's value is an ordered way through those layers. This chapter gives you the tools, the workflow, and the cluster-level mechanisms — eviction, autoscaling, tenancy, upgrades, security — that create the incidents in the first place.

Observability: three sources, three tools

metrics-server is the minimal in-cluster metrics pipeline: it scrapes each kubelet for CPU and memory of every Pod and node, keeps only the latest sample, and serves the metrics.k8s.io API that kubectl top and the HPA read. It has no history; it is not monitoring. Prometheus (usually installed as the kube-prometheus-stack chart) scrapes metrics endpoints on a schedule and stores time series. The endpoints that matter: the kubelet's cAdvisor metrics (container_cpu_cfs_throttled_periods_total — the throttling metric — and container_memory_working_set_bytes, the number the OOM killer actually compares to the limit), kube-state-metrics (the state of objects: restarts, Pending Pods, unavailable replicas, HPA status), and your application's own /actuator/prometheus endpoint from Micrometer. OpenTelemetry is the vendor-neutral standard for traces, metrics, and logs from the application; the OpenTelemetry Collector runs as a DaemonSet or Deployment and forwards to whatever backend you use. Logs go to stdout, the kubelet writes them to files on the node, and a DaemonSet (Fluent Bit, Vector, the Collector) ships them off the node — which is why a Pod that logs to a file inside the container is invisible.

Four alerts that catch most Kubernetes-layer incidents before users do: containers restarting (kube_pod_container_status_restarts_total rising), Pods Pending for more than five minutes, Deployments with unavailable replicas after a rollout should have finished, and CPU throttling above 25 percent of periods for a latency-sensitive service.

The debugging workflow, in order

The workflow is the same every time, and it follows the control loop backwards: find which loop stopped making progress. The session below investigates a Pod that keeps restarting, with the meaning of each command afterwards.

terminal — debugging a restarting Pod
$ kubectl get pods -n shop
NAME                      READY   STATUS             RESTARTS      AGE
orders-5b8d7f6c9d-hx2tq   0/1     CrashLoopBackOff   6 (92s ago)   11m
orders-5b8d7f6c9d-k4mzr   1/1     Running            0             11m
orders-5b8d7f6c9d-p9wd2   1/1     Running            0             11m

$ kubectl describe pod orders-5b8d7f6c9d-hx2tq -n shop
...
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       OOMKilled
      Exit Code:    137
      Started:      Thu, 27 Aug 2026 14:02:11 +0000
      Finished:     Thu, 27 Aug 2026 14:03:48 +0000
    Restart Count:  6
    Limits:
      memory:  1Gi
    Requests:
      cpu:     500m
      memory:  1Gi
...
Events:
  Type     Reason     Age                  From     Message
  ----     ------     ----                 ----     -------
  Normal   Pulled     3m (x7 over 11m)     kubelet  Container image "registry.example.com/shop/orders:2.4.1" already present on machine
  Normal   Created    3m (x7 over 11m)     kubelet  Created container orders
  Normal   Started    3m (x7 over 11m)     kubelet  Started container orders
  Warning  BackOff    45s (x28 over 9m)    kubelet  Back-off restarting failed container

$ kubectl logs orders-5b8d7f6c9d-hx2tq -n shop --previous | tail -n 3
2026-08-27T14:03:41.118Z  INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8080
2026-08-27T14:03:44.902Z  INFO 1 --- [ main] c.e.shop.orders.OrdersApplication          : Started OrdersApplication in 91.4 seconds
2026-08-27T14:03:47.310Z  WARN 1 --- [ main] c.e.shop.orders.cache.CatalogWarmup       : loading 2,400,000 catalog rows into local cache

$ kubectl top pod -n shop -l app.kubernetes.io/name=orders
NAME                      CPU(cores)   MEMORY(bytes)
orders-5b8d7f6c9d-k4mzr   212m         961Mi
orders-5b8d7f6c9d-p9wd2   198m         958Mi

$ kubectl get events -n shop --sort-by=.lastTimestamp | tail -n 4
9m    Normal    ScalingReplicaSet   deployment/orders   Scaled up replica set orders-5b8d7f6c9d to 3
9m    Normal    ScalingReplicaSet   deployment/orders   Scaled down replica set orders-6d9c7b8f4b to 0
45s   Warning   BackOff             pod/orders-5b8d7f6c9d-hx2tq   Back-off restarting failed container

Read the session. get pods shows one of three Pods in CrashLoopBackOff: the kubelet has restarted it six times and is now waiting an increasing back-off (10 seconds, 20, 40, up to five minutes) before trying again. describe is the single most useful command in Kubernetes because it joins the Pod's spec, its status, and its events: Last State: Terminated, Reason: OOMKilled, Exit Code: 137 tells you the kernel killed it (137 is 128 plus signal 9), the limits block tells you the ceiling was 1 GiB, and the events tell you the image was already present (so this is not a pull problem) and that the container runs for about 97 seconds each time. logs --previous reads the log of the crashed container, not the fresh one — the flag people forget — and the last line before death is a warm-up loading 2.4 million rows into a local cache. top shows the two survivors at 960 MiB, which is 94 percent of the limit; they happened to survive their warm-up by a few megabytes. The rollout events confirm this began with version 2.4.1. The diagnosis: the new version's cache warm-up pushed the working set past the limit on one Pod; the fix is a smaller cache or a larger limit, and the prevention is an alert on working-set memory above 85 percent of the limit. Notice that kubectl was enough: no shell into a container, no SSH to a node.

When you do need to look inside, kubectl exec -it <pod> -- sh gets a shell — unless the image is distroless and has no shell, which the security baseline recommends. The answer is an ephemeral container: kubectl debug -it <pod> --image=busybox --target=orders attaches a temporary container with tools into the running Pod's namespaces, so you can inspect the process, its network, and its files without changing the image. kubectl debug node/<node> -it --image=ubuntu does the same for a node, giving you its filesystem under /host. And kubectl port-forward tunnels a local port to a Pod or Service so you can hit an actuator endpoint from your laptop.

Node pressure and eviction

Nodes run short of memory, disk, or process IDs, and the kubelet defends the node by evicting Pods. It watches signals (memory.available, nodefs.available, imagefs.available, pid.available) against eviction thresholds — hard thresholds (act immediately; the default for memory is 100 MiB available) and soft ones (act after a grace period). When a threshold is crossed, the kubelet ranks Pods by whether their usage exceeds their requests, then by priority class, then by how far above request they are — which is exactly why Guaranteed Pods survive and BestEffort Pods go first — and evicts until the signal recovers. The evicted Pod's status says Evicted, and its controller replaces it elsewhere. A node that exhausts memory faster than the kubelet can react hits the kernel's OOM killer instead, and if it takes out the kubelet or containerd the node goes NotReady; after the node-monitor-grace-period (40 seconds) the Node controller marks it unreachable, and after the taint-based eviction tolerance (5 minutes by default) every Pod on it is deleted and rescheduled. That five-minute window is the "node NotReady and the cluster is evicting" incident: the cluster is doing the right thing, slowly, and the fix is to make sure the remaining nodes have capacity for the refugees — which is where a PDB with too-tight numbers or a cluster at 95 percent allocation turns a single node loss into an outage.

Node: 32 GiB · memory.available drops below 100 MiB (hard threshold) kubelet ranks Pods: usage > request? → priority class → usage minus request 1st · BestEffort no requests set e.g. ad-hoc debug Pod, 3 GiB evicted immediately 2nd · Burstable over request request 1 GiB, using 2.5 GiB ordered by excess over request evicted if still under pressure last · Guaranteed / under request request = limit = 1.5 GiB using 1.4 GiB survives until nothing else is left Your memory request is your position in this queue — set it equal to the limit for anything that must survive Evicted Pods are recreated by their controller on another node; the node itself stays Ready
Fig. E10.6 — Node-pressure eviction order. The kubelet protects the node by removing the Pods that are furthest over their promises; a Pod that made no promise has no standing at all.

Scaling the cluster itself: Cluster Autoscaler and Karpenter

The HPA adds Pods; something must add nodes when Pods go Pending for lack of room. The Cluster Autoscaler watches for Pods that failed scheduling on resource grounds and grows a pre-defined node group (an autoscaling group of one instance type) until they fit, and shrinks groups whose nodes have been under-used for ten minutes — after draining them, respecting PDBs. Its limits: it only picks from node groups you defined, so a Pod that needs 64 GiB stays Pending if no group has that size, and it scales one group at a time. Karpenter (an AWS-originated CNCF project, also on Azure) does away with node groups: it reads the Pending Pods' requirements — CPU, memory, zone, architecture, GPU — and provisions the cheapest instance type that satisfies them directly from the cloud API, usually in under a minute, and consolidates continuously by replacing under-used nodes with fewer or cheaper ones. Either way, three things must be true for cluster autoscaling to work: Pods have accurate requests (the autoscaler reasons about requests, not usage), PDBs allow drains, and the cloud account has quota for the instances. The "Pending pods for 20 minutes" incident is nearly always one of those three, or an autoscaler that is not running at all.

Multi-tenancy, cost, and upgrades

Sharing a cluster between teams is a spectrum. Soft multi-tenancy — one namespace per team or per service, with ResourceQuota, LimitRange, default-deny NetworkPolicies, RBAC scoped to the namespace, and Pod Security Admission at restricted — is the standard within one company and is what the design questions expect. Hard multi-tenancy — untrusted tenants — needs more than namespaces: separate node pools with taints per tenant, sandboxed runtimes (gVisor, Kata), or separate clusters, because the kernel is shared and a container escape lands on the node. Between them, tools like vCluster give each team a virtual control plane on shared nodes.

Cost on Kubernetes is the gap between what Pods request and what they use, multiplied by node hours. A cluster where the average request is three times the average usage is paying for two idle clusters. The levers, in order of return: right-size requests from real usage (the Vertical Pod Autoscaler in recommendation mode tells you the numbers), let the autoscaler consolidate, use spot or preemptible instances for anything stateless with a PDB and a graceful shutdown, and show each team its own cost (OpenCost or Kubecost attribute node cost to namespaces by request share).

Upgrades happen roughly three times a year, since the project ships three minor versions annually and supports each for about 14 months. The control plane is upgraded first (managed services do this in place), then nodes are replaced one pool at a time — new nodes with the new kubelet join, old nodes are cordoned and drained (PDBs again), and removed. The kubelet may be up to three minor versions behind the API server, which is what makes rolling node upgrades safe. What breaks during upgrades is almost always a removed API: check with a tool like kubent or Pluto before upgrading, because a manifest using an API version that was removed will be rejected at the next apply.

The security baseline, in one list

🧠 Brain power

Before reading on: a cluster runs 30 nodes at 92 percent of allocatable memory requested. A platform engineer runs kubectl drain on one node for a kernel patch. Every Deployment on it has a PDB with minAvailable: 2 and three replicas. What happens, in order, and where does it get stuck?

Reveal the answer

Drain cordons the node (marks it unschedulable) and then asks the eviction API to evict each Pod in turn. Each eviction checks the Pod's PDB: with three replicas and two required, one Pod may go, so the first eviction of each Deployment is allowed. The evicted Pod is deleted; its ReplicaSet creates a replacement, which goes Pending because the remaining 29 nodes at 92 percent have no room for most of them. The Cluster Autoscaler, if present, sees the Pending Pods and adds a node — after two to five minutes. Until the replacement is Ready, the Deployment is at two of three, so the PDB now blocks any further eviction of that Deployment on any node — which is fine here, since only one node is draining. The drain completes once the replacements are Ready. Where it gets stuck: if there is no autoscaler, or its group is at maximum size, or a cloud quota blocks the new instance, the replacements never schedule, and the drain finishes anyway (the PDB only guards evictions, not the wait for replacements), leaving every Deployment that lived on that node at two of three — one more node loss from a real outage. The prevention is capacity headroom (a cluster should not run above about 80 percent requested) and a rule that drains wait for replacements to be Ready.

07 · DrillArchitecture, Objects & Scheduling — Q1–Q40

The architecture round is where interviewers separate people who have used Kubernetes from people who understand it. The questions look bookish — "what does the scheduler do?" — but every follow-up is a production story: what if this component dies, why is this Pod stuck, who wins when two controllers disagree. These forty questions drill the control loop, the object model, the scheduler, and the API machinery underneath all of it. Say each answer aloud, in the order you would actually reason, before you reveal.

Drill · The control plane and the loop

These questions test whether you can name the actor at every step, and whether you know what keeps working when each actor is gone.

Q1. "Walk me through exactly what happens, component by component, when you run kubectl apply on a Deployment — from the keystroke to a container receiving traffic."

Reveal answer

The real test Whether you know that nothing runs when the API server says "created", and which loop wakes up next.

Strong answer kubectl sends the object to the API server as an HTTP request. The API server authenticates me, authorises the verb through RBAC, runs mutating and validating admission, and writes the Deployment to etcd — at that instant nothing is running. The Deployment controller, holding a watch on Deployments, sees the new object and creates a ReplicaSet with the Pod template. The ReplicaSet controller sees the ReplicaSet and creates Pod objects, which have no node yet and show as Pending. The scheduler watches for unscheduled Pods, filters nodes that cannot fit them, scores the rest, and writes a binding that sets spec.nodeName. The kubelet on that node sees a Pod assigned to it, calls the CNI plugin to create the network namespace and allocate an IP, asks containerd to pull the image and start the containers inside a cgroup with the resource limits, and begins the probes. When the readiness probe passes, the kubelet marks the Pod Ready; the EndpointSlice controller adds its IP to the Service's endpoints; kube-proxy on every node updates its rules. Only then does the Pod receive traffic.

Land it Every arrow in that story goes through the API server and etcd, which is why any one of those programs can restart without the cluster losing its place.

Likely follow-ups
"Where in that chain is the first place a bad manifest gets rejected, and where is the last?"

The first rejection point is inside the API server before anything is stored. A field name typo fails schema validation, a quota breach fails the ResourceQuota admission plugin, and a policy violation fails a validating webhook, so kubectl gets a 4xx immediately and nothing is written. The last rejection point is the kubelet, minutes later. An image tag that does not exist, a missing Secret referenced by name, or a volume that cannot attach all pass the API server because it only checks shape, not existence. Those surface as events on the Pod: ErrImagePull, CreateContainerConfigError, FailedMount. The practical consequence is that a green kubectl apply proves only that the object is well-formed. My pipeline has to wait on kubectl rollout status, which reads the Deployment's conditions, before it can claim the deploy succeeded.

"How long does each hop usually take, and which one dominates?"

The control-plane hops are fast. The API server write is single-digit milliseconds, the Deployment and ReplicaSet controllers react within tens of milliseconds because they hold watches, and the scheduler binds a Pod in well under a second on a healthy cluster. The kubelet side dominates. Creating the network sandbox through the CNI plugin takes a second or two, pulling an image that is not cached can take 10 to 60 seconds for a 300 MiB JVM image, and then the application itself starts, which for Spring Boot is 20 to 90 seconds. Then the readiness probe has to pass and the EndpointSlice update has to reach kube-proxy on every node, another second or two. So of a typical 60-second "created to serving" window, the cluster machinery is perhaps three seconds and the image plus the JVM is the rest. That is why image caching and startup time are where I optimise.

"What if the scheduler is down when the Pods are created?"

The Pods are created normally and sit Pending with an empty spec.nodeName. Nothing else breaks: the ReplicaSet controller has done its job, the API server holds the objects, and running Pods elsewhere are unaffected. When the scheduler comes back it lists all unscheduled Pods and works through its queue, so the backlog drains in seconds. This is the level-triggered design paying off. The scheduler is normally run with leader election across the control-plane replicas, so the real failure looks like a leader lease that is not being renewed. I would check the Lease object named kube-scheduler in kube-system, and alert on Pods that stay Pending with no FailedScheduling event at all, because that specific pattern, Pending without any scheduler event, means nobody is looking rather than nowhere fits.

"You said kube-proxy updates rules on every node. What if kube-proxy is slow or missing on one node?"

Then that node keeps routing Service traffic by its stale rules. Its local clients would still send connections to Pod IPs that have since terminated, getting connection refused or timeouts, and would never learn about new Pods. Every other node is fine, so the symptom is an error rate that is proportional to the traffic originating on that one node, which is a useful diagnostic signature. kube-proxy runs as a DaemonSet so I would check its Pod on that node and its logs, and look at the metric kubeproxy_sync_proxy_rules_duration_seconds for slow rule syncs on large clusters. On clusters that replace kube-proxy with Cilium's eBPF datapath the same failure shows up as a stale eBPF map on that node, and the diagnosis is the same: one node's view of endpoints has fallen behind the API server's.

Q2. "Why do Kubernetes components never call each other directly? What does the watch mechanism actually buy?"

Reveal answer

Strong answer Every component reads and writes through the API server, and etcd is the only durable state. A watch is a long-lived HTTP connection on which the API server streams every change to a set of objects, so a controller sees a new Pod milliseconds after it is written without polling. The design buys three things. First, decoupling: the scheduler does not know the kubelet exists, and the Deployment controller does not know the scheduler exists; each one reacts to objects, so you can replace or add components without changing the others. Second, recoverability: if a controller crashes, on restart it lists the current objects, rebuilds its picture, and continues from wherever the desired state now is, because that state was never inside the crashed process. Third, extensibility: my own operator uses the identical mechanism, a watch on my own custom resource, and the built-in controllers cannot tell it apart from themselves. The cost is that everything is eventually consistent — a write returns before anything has happened — so clients must observe status rather than assume completion.

Land it The hub-and-spoke shape is the whole reason Kubernetes tolerates component restarts, and the reason "created" never means "running".

Likely follow-ups
"What happens when a watch connection drops? Does the controller miss events?"

A watch is started from a specific resourceVersion, and every event carries the resourceVersion it corresponds to. When the connection drops, the client reconnects and asks for events since the last version it saw. The API server keeps a short history in its watch cache, five minutes by default, so a brief drop is replayed with nothing lost. If the client was away longer, the server answers with a 410 Gone, and the client does a full list to rebuild its picture and then starts a fresh watch from that list's version. client-go's informer machinery does all of this automatically, and the reason it is safe is level-triggered reconciliation: after a relist the controller compares full state, so any event it never saw is irrelevant. That is exactly why the design tolerates a dropped connection without a correctness bug.

"What does the watch cost the API server, and what breaks at 10 times the number of watchers?"

Each watch is a long-lived connection plus a goroutine and a filter on the server. The API server serves them from its in-memory watch cache, so a hundred watches on Pods cost one etcd watch and a hundred fan-outs. The expensive part is the initial list, especially a cluster-wide list of Pods, because it has to serialise thousands of objects. At ten times the watchers the problems are memory for the cache and the fan-out, CPU spent serialising events per watcher, and, if many clients relist at once after a control-plane restart, a thundering herd. Mitigations are API priority and fairness, which is on by default and puts controllers in flow-schemas with concurrency limits, streaming list which has been beta since 1.32 as of Aug 2026 and lets a client build its cache from the watch stream instead of a giant list, and label-scoped or namespace-scoped informers in my own controllers.

"If a write returns before anything happened, how does a client know when it is actually done?"

It has to observe status, and every workload object publishes conditions for that purpose. A Deployment has Progressing and Available conditions and observedGeneration; the rule is that status is only meaningful when status.observedGeneration equals metadata.generation, which proves the controller has seen my latest spec. kubectl rollout status implements exactly this wait, and kubectl wait --for=condition=Available does the generic version. In a pipeline I never treat the apply exit code as success; I apply, then wait on the condition with a timeout, and treat the timeout as a failure to be investigated. For my own custom resources I follow the same convention: a status.conditions array with type, status, reason, and observedGeneration, so that a GitOps tool such as Argo CD can compute health from it the same way it does for built-in kinds.

Q3. "What does etcd do for the cluster, why is it usually three or five members, and what happens to a running cluster when etcd loses quorum?"

Reveal answer

Strong answer etcd is the cluster's only database: every object, in serialised form, keyed by path. It replicates with the Raft consensus algorithm — one elected leader, and a write is committed once a majority of members have it on disk — which is why an odd number matters: three members tolerate one failure, five tolerate two, and four tolerate only one while costing more. A majority is called quorum. If quorum is lost, etcd refuses writes and, by default, linearisable reads, so the API server returns errors for most operations. The crucial point for an interview is what keeps working: every Pod already running keeps running, kube-proxy rules stay in place, DNS keeps answering from CoreDNS's cache of what it last saw, so user traffic continues. What stops is change — no new Pods, no rescheduling if a node dies, no scaling, no rollouts, no self-healing. It is a frozen cluster, not a dead one. Recovery is restoring quorum by bringing members back or, in the worst case, restoring from a snapshot taken with etcdctl snapshot save, which every self-managed cluster must schedule.

Land it Losing etcd freezes the cluster rather than killing it — but a frozen cluster becomes a dead one the moment the first node fails.

Likely follow-ups
"Why not seven or nine members if more tolerance is better?"

Because every write has to be acknowledged by a majority before it is committed, and each extra member adds a network round trip and a disk fsync to the critical path. Seven members tolerate three failures but make every write wait for four acknowledgements, and the leader has to stream every change to six followers. The etcd project's own guidance is that five is the practical maximum for a production cluster and that beyond five you are trading write latency for reliability you almost never use. Three failures at once in a control plane usually means a data-centre problem where etcd is not your biggest worry. If I need read scale rather than fault tolerance I would add learner members, which receive the log but do not vote, or put a caching layer in front, not grow the voting set.

"How would you restore from a snapshot, and what do you lose?"

I would stop every API server so nothing writes during the restore, then on each etcd member run etcdctl snapshot restore with the snapshot file, a fresh data directory, and the full initial-cluster list so the members form a new cluster with a new cluster ID. Then start etcd, verify with etcdctl endpoint status that all members agree on the revision, and start the API servers. What I lose is every write between the snapshot and the failure, so with a 15-minute snapshot schedule that is up to 15 minutes of changes: Deployments applied, scale events, Secrets rotated. The controllers will then reconcile the real world back toward the restored state, which can mean deleting Pods that were created after the snapshot. That is why I want GitOps as well: after a restore, the agent re-applies Git and closes the gap.

"etcd has an 8 GiB hard limit. Why is the database so small, and what fills it up?"

The database is small because it is a consensus log with every object serialised in it, and every write goes through Raft and a fsync on every member. A general-purpose store would page to disk and scale out; etcd instead holds the whole keyspace in a memory-mapped B+ tree and keeps a history of revisions until compaction. What fills it is history and churn more than object count. Events are the classic culprit because every probe failure and image pull writes one, with a one-hour TTL. Then Jobs that create thousands of Pods, controllers that update status every second, and large ConfigMaps or Secrets near the 1 MiB object limit. Compaction removes old revisions and defragmentation reclaims the space on disk. On a managed cluster I cannot see the database, but I can still bloat it, which is why cloud providers cap object counts.

"What is the actual default etcd quota, and what happens when it is hit?"

As of Aug 2026 the default --quota-backend-bytes is 2 GiB, and 8 GiB is the maximum the maintainers consider safe, so most self-managed clusters raise the flag toward 8 GiB deliberately. When the database reaches the quota, etcd raises a NOSPACE alarm and switches the cluster to read-only: every write from the API server fails with "etcdserver: mvcc: database space exceeded", which users see as errors on any create or update while reads and running workloads continue. Recovery is a sequence, not a restart: compact with etcdctl compact to the current revision, defragment each member one at a time with etcdctl defrag, and only then clear the alarm with etcdctl alarm disarm. Skipping the defrag leaves the file the same size and the alarm comes straight back.

Q4 · Scenario. "kubectl commands take 20–40 seconds or time out. Pods are running fine. The platform team says etcd is 'slow'. Walk me through the diagnosis."

Reveal answer

The real test Whether you know etcd is disk-latency-bound and that large list requests and object bloat are the usual culprits.

Strong answer I would diagnose in this order:

  1. Symptom confirmation. Time kubectl get --raw /readyz?verbose against the API server to separate an API server problem from an etcd one; check the API server's etcd_request_duration_seconds metric and etcd's own etcd_disk_wal_fsync_duration_seconds and etcd_disk_backend_commit_duration_seconds. If fsync p99 is above 10 milliseconds, the disk is the story.
  2. Evidence. Check the etcd database size (etcdctl endpoint status): over 4–6 GiB it degrades, and the default 8 GiB quota puts it into read-only "alarm" mode. Check whether compaction and defragmentation run. Check for leader elections in the etcd logs — a leader change every few minutes means members cannot keep up with heartbeats.
  3. Likely causes, ranked. First, slow or shared disks under etcd (a network volume, or etcd co-located with a busy workload) — etcd wants local NVMe. Second, database bloat from something writing huge or high-churn objects: thousands of Events, a Job spamming Pods, a controller updating status every second, or Secrets or ConfigMaps near the 1 MiB limit. Third, expensive API traffic — clients doing full cluster-wide list of Pods without pagination or watch caching, which the API server has to serve from etcd.
  4. Fix. Move etcd to fast local disk; compact and defragment; find the noisy writer with the API server audit log or apiserver_request_total by user agent and fix or rate-limit it; raise the quota only as a last resort.
  5. Prevention. Alert on fsync latency and database size; scheduled defragmentation; API priority and fairness settings to protect the control plane from bulk clients.

Going deeper One correction to the quota number: as of Aug 2026 etcd's default --quota-backend-bytes is 2 GiB, not 8 GiB; 8 GiB is the recommended upper bound that operators raise it toward. Hitting the quota raises a NOSPACE alarm and the cluster becomes read-only until compaction, defragmentation, and etcdctl alarm disarm have all run, in that order. Two more mechanisms an interviewer will probe. First, the API server's watch cache: most list requests are served from memory, but a list with an explicit resourceVersion="", which is what quorum reads and some older clients send, bypasses the cache and goes to etcd, which is why one badly written client can drag the whole control plane down. Second, request separation: etcd reports etcd_server_slow_apply_total and etcd_server_slow_read_indexes_total, and the API server reports apiserver_storage_objects per resource type; the resource with the largest object count and the fastest growth is nearly always the noisy writer. To verify a disk hypothesis before touching anything, run fio with the etcd project's recommended profile (sequential 2300-byte writes with fdatasync) on the etcd volume; a p99 fdatasync above 10 milliseconds fails etcd's own requirement regardless of what the cloud console calls the disk tier.

Going deeper One correction to the quota number: as of Aug 2026 etcd's default --quota-backend-bytes is 2 GiB, not 8 GiB; 8 GiB is the recommended upper bound that operators raise it toward. Hitting the quota raises a NOSPACE alarm and the cluster becomes read-only until compaction, defragmentation, and etcdctl alarm disarm have all run, in that order. Two more mechanisms an interviewer will probe. First, the API server's watch cache: most list requests are served from memory, but a list with an explicit resourceVersion="", which is what quorum reads and some older clients send, bypasses the cache and goes to etcd, which is why one badly written client can drag the whole control plane down. Second, request separation: etcd reports etcd_server_slow_apply_total and etcd_server_slow_read_indexes_total, and the API server reports apiserver_storage_objects per resource type; the resource with the largest object count and the fastest growth is nearly always the noisy writer. To verify a disk hypothesis before touching anything, run fio with the etcd project's recommended profile (sequential 2300-byte writes with fdatasync) on the etcd volume; a p99 fdatasync above 10 milliseconds fails etcd's own requirement regardless of what the cloud console calls the disk tier.

Land it etcd is a disk-latency machine with a small database — nearly every "etcd is slow" is either the wrong disk or someone treating it as a general-purpose store.

Likely follow-ups
"You compacted and defragmented and moved to faster disk. It is still slow. What next?"

Then the disk was not the bottleneck and I go back to the request side. First I confirm with the metrics: if etcd_disk_wal_fsync_duration_seconds is now healthy but apiserver_request_duration_seconds is still high, the API server itself is the bottleneck, not etcd. I look at apiserver_request_total broken down by verb, resource, and user agent to find who is hammering it, and at apiserver_flowcontrol_request_wait_duration_seconds to see whether requests are queuing in priority and fairness. Common findings are a monitoring agent listing all Pods every 10 seconds, an operator with a broken informer that relists constantly, or a CI system that runs kubectl get pods -A in a loop. I also check the API server's own CPU and memory, because on a managed cluster the control plane is sized by the provider and a busy cluster can simply outgrow the small tier.

"How do you find the noisy client on a managed cluster where you cannot see etcd?"

I use the API server's own signals, which the cloud exposes even when etcd is hidden. The audit log, if enabled at the Metadata level, has every request with its user, user agent, verb, and resource, so a quick aggregation by user agent over an hour ranks the callers. Without audit logs, the metrics endpoint has apiserver_request_total with a user agent label on some builds, and the cloud's control-plane logs, such as EKS's api log stream or GKE's control plane logs in Cloud Logging, carry the same fields. I sort by list and watch on cluster-scoped resources, because a get on one object is cheap and a list of all Pods is not. Once I have the offender, I check whether it uses pagination with limit and continue, whether it could use a namespaced informer, and whether it is relisting because its watch keeps failing.

"What does API priority and fairness actually do, and how would you protect the control plane with it?"

API priority and fairness, on by default, classifies each request into a FlowSchema, which maps it to a PriorityLevelConfiguration. Each priority level has a concurrency share, and within a level, requests are queued fairly across flows, where a flow is typically a user or a namespace. The effect is that one client cannot occupy all the API server's request slots. The built-in levels give kube-system controllers and the leader-election traffic the highest share, then normal workloads, then catch-all. To protect the control plane from a bulk client I would create a FlowSchema matching that client's user or ServiceAccount and point it at a low-priority level with a small concurrency share, so its lists queue and time out rather than starving the scheduler. The metric apiserver_flowcontrol_rejected_requests_total tells me when that is happening.

"How would you prevent this from recurring at 10 times the cluster size?"

At ten times the size the object count is the enemy, so I would put limits in front of growth. Set ttlSecondsAfterFinished on every Job so finished Pods are deleted, cap Event retention through the API server's --event-ttl or send Events to a sink and drop them from etcd, and enforce ResourceQuota object counts per namespace so no team can create 50,000 ConfigMaps. I would also split the cluster before it reaches that size: several clusters of a few hundred nodes are easier to run than one of five thousand, because etcd's throughput does not scale and every controller relists everything. On the etcd side, dedicated members on local NVMe with a separate etcd for Events, which kubeadm supports through --etcd-servers-overrides, so the noisiest resource has its own disk.

Q5. "What is server-side apply, and how does it stop an HPA and a CI pipeline from fighting over the replica count?"

Reveal answer

Strong answer Classic client-side apply computed a three-way diff on the client between the last applied configuration stored in an annotation, the live object, and the new file, then sent a patch. Server-side apply, stable since 1.22, moves the merge into the API server and adds field management: the object records, in metadata.managedFields, which manager — kubectl, Argo CD, the HPA controller — owns each field. When a manager applies an object, it asserts ownership only of the fields present in its request. So if my Deployment manifest omits replicas, the HPA owns that field and my next apply leaves it alone. If my manifest includes replicas: 3 while the HPA has set it to 12, the server reports a conflict instead of silently resetting production to three Pods, and I have to pass --force-conflicts to take the field over. The practical rule that follows: a Deployment managed by an HPA should not carry a replicas field in Git at all, and GitOps tools have an explicit "ignore differences" setting for exactly this field.

Land it Field ownership turns "who last wrote this" into an explicit conflict, which is the only sane way for several controllers to share one object.

Likely follow-ups
"What happens if you switch a Deployment from client-side apply to server-side apply for the first time?"

The first server-side apply sees an object with fields managed by the old kubectl client-side manager, recorded from the last-applied-configuration annotation, and by whatever controllers touched it. Kubernetes handles the migration deliberately: when a manager named kubectl applies server-side for the first time, the server upgrades the client-side entry in managedFields into a server-side one, so the fields my manifest sets are owned by me with no conflict. Fields in the live object that my manifest does not mention stay owned by whoever set them and are left alone. The trap is a field I used to set but have since removed from the manifest: under client-side apply that was pruned, and under server-side apply it is also removed on the migrated apply because ownership transferred, which can surprise people. I run kubectl diff --server-side first to see it.

"How do Argo CD or Flux deal with the HPA-owned replicas field?"

Both have explicit settings because this is the most common drift in every GitOps installation. In Argo CD I set ignoreDifferences on the Application with jsonPointers /spec/replicas for the Deployment, and pair it with RespectIgnoreDifferences=true in syncOptions so the ignored field is not written back on sync; otherwise Argo shows the app as Synced but still overwrites replicas when it applies. Flux, which uses server-side apply natively, simply respects field ownership: if the manifest in Git has no replicas field the HPA owns it and Flux never touches it. The cleanest answer in both cases is the same: delete replicas from the manifest entirely. If a team insists on keeping it as documentation, a Kustomize patch that strips it before apply is a reasonable compromise.

"Which manager wins on a conflict, and when would you actually use --force-conflicts?"

Nobody wins automatically. A server-side apply that touches a field owned by a different manager gets a 409 with a message naming the field and the other manager, and the object is not changed. With --force-conflicts, my manager takes ownership and the other manager's entry for that field is removed. The legitimate uses are one-off, deliberate ownership transfers: migrating from one deploy tool to another, taking back a field that a mutating webhook stamped and that is now handled in Git, or fixing a situation where a decommissioned controller still holds ownership. I would never put --force-conflicts in a pipeline as a default, because that turns the conflict detection off and I am back to last-writer-wins, which is the failure server-side apply was built to remove.

"Does server-side apply change how you write your own controllers?"

Yes, and for the better. In controller-runtime I use client.Apply patches with a fixed field manager name and an unstructured or typed apply configuration that contains only the fields my controller cares about. The server then merges my fields with whatever users set by hand, and if a user changes one of my fields I get a conflict instead of a silent tug of war. For status I use the status subresource with the same manager. The rules I follow: one stable manager name per controller, never a name that changes per replica or per run, because a new name creates a fresh owner and both old and new entries pile up in managedFields; and pass ForceOwnership only for fields the controller is designed to own outright, such as the replica count of a child object it created.

Q6. "In what order does the API server process a write, and where exactly do admission webhooks, RBAC, and schema validation sit?"

Reveal answer

Strong answer The order is fixed and worth reciting. First, authentication: who is calling — a client certificate, a bearer token, an OpenID Connect identity, or a ServiceAccount token. Second, authorisation: may this identity perform this verb on this resource in this namespace, answered by RBAC (or a webhook authoriser). Third, mutating admission: built-in plugins and mutating webhooks may change the object — inject a sidecar, add default resources from a LimitRange, set a ServiceAccount. Fourth, schema validation against the resource's OpenAPI definition, so a typo in a field name is rejected here. Fifth, validating admission: built-in checks such as ResourceQuota and Pod Security Admission, ValidatingAdmissionPolicy rules in CEL, and validating webhooks, any of which can reject with a message. Only then is the object written to etcd and watchers notified. Two consequences: mutation happens before validation, so a validating policy sees the injected sidecar; and a webhook that is down blocks every write it is registered for unless its failurePolicy is Ignore, which is how a broken policy engine takes down deploys cluster-wide.

Land it Mutate, then validate, then store — and every webhook in that chain is a component whose downtime becomes your deploy downtime.

Likely follow-ups
"A validating webhook is down and it is blocking all deploys. What do you do in the next five minutes?"

First I confirm the symptom from the error text, which names the webhook and the service it could not reach. Then I get its Pods healthy if I can, because that fixes it without touching policy. If I cannot, I choose between two edits to the ValidatingWebhookConfiguration: change failurePolicy from Fail to Ignore, which lets writes through unvalidated while it is down, or narrow its namespaceSelector so the namespace I must deploy to is excluded. I prefer the second in production because it is scoped. I would never delete the configuration, because reinstalling it correctly under pressure is error-prone. Afterwards, the fix is structural: run the webhook with at least two replicas, a PDB, a PriorityClass, a short timeoutSeconds such as 5, and exclude kube-system and the webhook's own namespace so it can never block its own recovery.

"Why would you use a ValidatingAdmissionPolicy in CEL instead of a webhook?"

Because the policy runs inside the API server, so there is no network call, no extra component to keep alive, and nothing whose downtime blocks writes. ValidatingAdmissionPolicy has been stable since 1.30 and MutatingAdmissionPolicy is beta as of Aug 2026. I write a rule in CEL, the Common Expression Language, such as requiring every container to have a memory limit or forbidding the latest tag, bind it to namespaces with a ValidatingAdmissionPolicyBinding, and can test it in warn or audit mode first. The limits are that CEL cannot call out to external systems or look up arbitrary other objects beyond a few parameter resources, so an image signature check or a lookup against a registry still needs a webhook. My rule of thumb is that anything expressible as a predicate over the object goes in CEL, and webhooks are reserved for checks that need outside data.

"Can a mutating webhook see the output of another mutating webhook?"

Not reliably on the first pass. Mutating webhooks run in an order that is alphabetical by configuration name, and each sees the object as modified by the ones before it, but a webhook cannot assume which others exist. Because a later mutation can invalidate an earlier one, the API server has a reinvocation policy: if any webhook with reinvocationPolicy IfNeeded changed the object, the earlier webhooks are called a second time so they can react. Even so, it is a single reinvocation round, not a fixed point, so two webhooks fighting over the same field is a bug to fix in policy, not something the server resolves. This is why mesh injectors and resource-defaulting webhooks are sensitive to naming order, and why I keep mutations idempotent so being called twice does no harm.

"Where does RBAC check happen for a sub-resource like pods/exec or scale?"

In the same authorisation step, but the resource being authorised is the subresource itself, which is why RBAC rules name them separately. A role that allows get on pods does not allow create on pods/exec, and updating a Deployment's replica count through kubectl scale needs update on deployments/scale, not on deployments. The status subresource is the same story, which is what lets a controller's ServiceAccount be granted update on myresource/status without being able to change the spec. Interviewers use this to check that I know the practical implication: the developer role in production can grant exec in staging and withhold it in production purely through the subresource verb, and the audit log records the subresource, so I can prove who ran a shell in which container.

Q7 · Scenario. "The kube-controller-manager has been down for fifteen minutes. A node just died. What do users experience, what does the cluster look like, and what happens when it comes back?"

Reveal answer

Strong answer In diagnosis order: the symptom users see is a small error rate, not an outage. Running Pods on other nodes keep serving; the dead node's Pod IPs remain in the Service endpoints because the Node controller — which lives inside the controller manager — is not there to mark the node unhealthy and the EndpointSlice controller is not there to remove them. Connections hashed to those IPs time out until clients retry. The evidence I would collect: kubectl get componentstatuses is deprecated, so I would check the controller manager's leader-election lease in kube-system and its /healthz; kubectl get nodes still shows the dead node Ready with a stale heartbeat age; get pods shows its Pods Running with old status. Nothing self-heals: no replacement Pods, no Job progress, no HPA scaling (that controller also lives there), no garbage collection. When the controller manager returns, it relists everything; the Node controller sees the stale heartbeat, marks the node NotReady, and after the eviction tolerance deletes its Pods; the ReplicaSet controller notices the missing replicas and creates new ones; the EndpointSlice controller fixes endpoints. Prevention: run it with leader election across three replicas — the default on managed clusters — and alert on the leader lease age.

Land it The data plane is independent of the control plane, so a lost controller manager delays healing rather than breaking serving — the outage is the node death compounded by nobody noticing it.

Likely follow-ups
"You said users see a small error rate. Quantify it, and say what shortens it even with the controller manager down."

If the dead node held one of ten replicas, then roughly 10 percent of new connections are routed to a dead IP until the client's connect timeout fires, and clients that retry on a different connection mostly succeed on the second attempt. So the visible effect is a latency spike equal to the connect timeout on a tenth of requests, plus errors from clients with no retry. Two things shorten it without the controller manager. Readiness-based removal cannot help because that also flows through the EndpointSlice controller. But a service mesh or a client-side load balancer with outlier detection, such as Envoy's ejection after consecutive 5xx or connect failures, stops sending to the dead IP within seconds based on observed failures alone. And short client connect timeouts, one to two seconds rather than the OS default of over a minute, cap the damage per request.

"How would you tell, in one command, whether the controller manager is actually running?"

I would read its leader lease: kubectl get lease kube-controller-manager -n kube-system -o yaml, and look at renewTime. A healthy leader renews every two seconds, so a renewTime more than 15 seconds old means no instance holds leadership and none of the controllers are running. On a self-managed cluster I would follow up with kubectl get pods -n kube-system -l component=kube-controller-manager and its logs; on a managed cluster the Pods are invisible, so the lease is the only view, plus the provider's control-plane logs. The alert I would want permanently is on that lease age, and the same for kube-scheduler and for the cloud-controller-manager, which on managed clusters is what reconciles load balancers and node lifecycle.

"When it comes back, is there any risk from the burst of catching up?"

Yes, and it is worth naming. On start it relists every resource type it manages, which is a large read burst on the API server, and then every controller acts on accumulated drift at once. The Node controller marks the dead node NotReady and, after the tolerance, evicts its Pods, the ReplicaSet controllers create replacements, garbage collection deletes orphans, and every Job and CronJob that missed a run decides what to do. If the CronJob's startingDeadlineSeconds is unset, missed runs are simply skipped; if it is set to a large value, several missed runs can be scheduled at once. The Node controller also has a rate limit on evictions, --node-eviction-rate of 0.1 nodes per second by default, and a lower rate when a large fraction of a zone is unhealthy, so a mass eviction is deliberately slowed to avoid thrashing a cluster that may be recovering from a network partition.

Q8. "What is a controller, precisely? Explain level-triggered versus edge-triggered reconciliation and why Kubernetes chose the former."

Reveal answer

Strong answer A controller is a loop that observes a desired state and an actual state and takes actions to reduce the difference. Edge-triggered means acting on events: "a Pod was deleted, so create one". Level-triggered means acting on the current state regardless of how it got there: "three are wanted, two exist, create one". Kubernetes controllers are level-triggered by design, even though they are woken by watch events. The reason is missed events. If a controller was down for a minute, or the watch connection dropped and resumed, edge-triggered logic would miss the deletions that happened meanwhile and never converge; level-triggered logic simply recounts and is correct. It also makes reconciliation idempotent: running it twice does no harm, which is essential because watch delivery is at-least-once. The practical shape of every controller, including ones I write with controller-runtime, is therefore: a work queue of object keys, a reconcile function that reads the object fresh from the cache and computes the full desired state, and a periodic resync that requeues everything so that even a bug in event handling is eventually corrected.

Land it Reconcile from the level, not the edge — that one design choice is why a controller can crash, miss a thousand events, and still be right when it comes back.

Likely follow-ups
"If reconciliation is idempotent, why do controllers still need a work queue with rate limiting?"

Idempotency makes repeated reconciles safe, not cheap. A reconcile usually reads several objects and may call an external API, so if every watch event triggered an immediate run, a busy object would be reconciled hundreds of times a second. The work queue deduplicates: if the same key is added ten times while a reconcile is in flight, it runs once more afterwards. The rate limiter handles failure: when a reconcile returns an error, the key is requeued with exponential back-off starting at milliseconds and capped around 16 minutes in controller-runtime's default, so a permanently broken object does not spin the loop. And a global token bucket bounds total reconciles per second across all keys. Without those, a level-triggered controller is still correct but can take down the API server or an external system by sheer volume.

"What goes wrong if two replicas of your controller run at once?"

They both see the same events and both try to create the same child objects. Because creation is not idempotent by default, one of them gets an AlreadyExists error, and both may issue conflicting updates and deletes in the window between reading and writing. For a controller that talks to an external system, such as creating a Kafka topic, it can genuinely create duplicates or race on deletion. That is why controllers use leader election: a Lease object in the controller's namespace that one replica renews every few seconds, with the others blocked until it expires. controller-runtime turns this on with LeaderElection true and a LeaderElectionID. The remaining risk is the handover window, where the old leader has lost the lease but has an in-flight reconcile, so reconciles should still be written to survive a duplicate, using create-or-update against the current state and optimistic concurrency on writes.

"How do you make a reconcile loop that calls an external API not hammer that API when it is down?"

I treat the external failure as a retriable error and let the work queue's back-off spread retries, and I return a requeue with a delay rather than a raw error when I know the wait will be long, so that one broken endpoint does not saturate the rate limiter for every object. I record a condition on the object's status, such as Ready False with reason ExternalUnavailable, so users can see why nothing is happening. I add a circuit breaker in the client so that after a burst of failures the controller checks once every 30 seconds instead of per object. And I keep the periodic resync, controller-runtime's SyncPeriod, at something like ten hours rather than the old default of a few minutes, because a resync on ten thousand objects against a slow external API is a self-inflicted outage.

"Give a concrete example where an edge-triggered design would have broken in production."

An early operator I saw handled the Deleted event for a Pod by removing that Pod from a load balancer. During a control-plane upgrade the operator was down for six minutes, in which time a rollout replaced every Pod. When it came back, the informer's relist delivered the current Pods, but the deletions it missed were never represented as events, so the load balancer kept the old IPs, which were then reused by unrelated Pods; traffic for the service started arriving at another team's containers. The level-triggered fix was to reconcile the load balancer's member list against the current Ready Pods on every run regardless of what triggered it, and to add a periodic resync as a safety net. The same logic explains why the built-in EndpointSlice controller recomputes slices from the full Pod set rather than applying deltas.

Q9 · Design. "We want to automate provisioning a database schema, a Kafka topic, and a Vault role every time a team creates a new service. Would you write a Kubernetes operator? Design it, and say when you would not."

Reveal answer

Strong answer Requirements: a team declares a service once and gets consistent infrastructure, with drift corrected and deletion handled. An operator fits when the thing being managed has a lifecycle that must be continuously reconciled — created, kept in sync, cleaned up — and when its consumers already live in the cluster. Design: a CustomResourceDefinition ServiceProfile with fields for the schema name, topic partitions and retention, and Vault role policy; a controller built with controller-runtime (Go) or the Java Operator SDK, reconciling each object by calling the database, Kafka admin, and Vault APIs idempotently and writing observed state into status with conditions; a finalizer on the object so deletion of the resource triggers cleanup before the object disappears; RBAC scoped so only the operator holds the powerful credentials; and Prometheus metrics for reconcile errors and duration. Trade-offs: an operator is a distributed-systems program with retries and partial failures, and it must handle the external system being down without wedging. I would not write one if the provisioning is one-shot and does not need continuous reconciliation — then a CI job, a Terraform module, or Crossplane (which already provides operators for cloud resources) is cheaper. And I would not write one in a team that cannot maintain a Go or Java service with on-call, because an unmaintained operator with cluster-wide credentials is a liability.

Land it Write an operator when the resource needs a loop, not just a script — and reach for Crossplane or Terraform first if the resources are plain cloud primitives.

Likely follow-ups
"The requirement changes: teams also want the operator to rotate the database credentials every 30 days. Does the design change?"

It strengthens the case for an operator, because rotation is a recurring lifecycle action with state, which is exactly what a reconcile loop is for. I would add a status field recording the last rotation time and requeue each object with a delay of 30 days minus elapsed, so the reconcile fires on time without a CronJob. The rotation itself has to be two-phase to avoid downtime: create the new credential, write it into the Secret the service mounts, wait until every Pod of the service has restarted or reloaded, which I can observe through the Deployment's rollout status or a checksum annotation, then revoke the old one. The new risk is that the operator now holds credentials that can lock a service out, so I would add a dry-run mode, a per-object annotation to pause rotation, and an alert if any object's rotation is more than a week overdue.

"You have two weeks and one engineer. What do you cut?"

I would cut the operator and ship the provisioning as an idempotent pipeline job triggered by a pull request that adds the service to a services.yaml in a platform repository. The job runs Terraform for the Vault role and a small script for the schema and the Kafka topic, and it is safe to rerun. That gives teams the self-service and the audit trail on day one. I would keep the CRD idea as the input schema even in the script version, so that when the operator arrives later the declared shape is already familiar. What I would not cut is idempotency and deletion handling, because a script that cannot be rerun after a partial failure becomes an on-call burden immediately. Drift correction and continuous reconciliation are the things I defer, since they are the operator's real value and the hardest to get right.

"How does your operator handle the Kafka cluster being unreachable for an hour during a reconcile?"

The reconcile for each ServiceProfile fails at the Kafka step, sets a condition on status such as TopicReady False with the error message, and returns an error so the work queue requeues with back-off. Everything already provisioned, the schema and the Vault role, stays as it is because each step is idempotent and checks before creating. When Kafka returns, the next reconcile finds the schema exists, the role exists, creates the missing topic, and flips the condition. Two details matter. The controller must not hold a finalizer hostage: if a user deletes the object during the outage, the delete blocks until Kafka is back, which is correct but must be visible, so the status says why. And the operator's own health should not depend on Kafka, otherwise its liveness probe would restart it repeatedly during the outage.

"Why is Crossplane not simply the answer here?"

Crossplane is the answer for the parts it has providers for. A Vault role is covered by the Vault provider, and a database or a topic on a managed cloud service is often covered too. Where it falls short is the application-specific logic: a schema with tables and grants, a topic naming convention with team-specific ACLs, and the composition of the three into one thing a team requests. Crossplane's Composition can bundle managed resources, and its composition functions let me write logic in Go or Python, so a plausible design is Crossplane for the cloud-native resources and a thin custom controller for the schema. The trade-off is operational: Crossplane is a large installation with its own upgrade cadence and CRD sprawl, and I would only adopt it if the platform team will use it for more than this one workflow.

Q10. "The API server is unreachable for ten minutes but every node is fine. What continues to work on the nodes, and what does the kubelet do meanwhile?"

Reveal answer

Strong answer Serving traffic continues untouched: containers keep running, kube-proxy's rules stay as they were, CoreDNS keeps answering from its last-known state (it cannot learn about changes), and Pod-to-Pod networking needs no control plane at all. The kubelet keeps doing its local job: it runs liveness probes and restarts containers that fail them, enforces limits, and evicts under node pressure, because those decisions are local. What it cannot do is report status or receive new Pods, so any Pod it restarts shows stale status to the outside, and readiness changes do not propagate — a Pod that becomes unready keeps receiving traffic because the EndpointSlice never updates. Static Pods (from the kubelet's manifest directory, used for the control plane itself on kubeadm clusters) keep running because they do not come from the API server. When the API server returns, the kubelet reports everything it did, and controllers catch up. The only thing at risk of falling over is workloads that themselves call the API — operators, autoscalers, service-mesh control planes — which should degrade gracefully rather than crash.

Land it A cluster without its API server is a set of machines that keep running what they were told last — fine for ten minutes, dangerous the moment anything needs to change.

Likely follow-ups
"What happens after the API server has been unreachable for longer than the node lease grace period?"

Nothing more on the nodes, but the control plane's view changes once it is back. While the API server is down the Node controller is also blind, so no node is marked NotReady during the outage itself. When the API server returns, the kubelets reconnect and renew their leases within seconds, so a clean recovery shows nothing. The dangerous variant is a partial one: the API server is up but one node cannot reach it. Then that node's lease goes stale, after the node-monitor grace period, 40 seconds in older releases and 50 seconds since 1.32, it is marked NotReady, the not-ready and unreachable taints are applied, and after the default 300-second tolerationSeconds its Pods are deleted and recreated elsewhere, while the originals keep serving on the isolated node. Stateless services now run at double replicas briefly; anything that must be unique is at risk.

"Does a ServiceAccount token expire during the outage and break the workload?"

It can, and this is a subtle one. Modern ServiceAccount tokens are projected volume tokens with a one-hour lifetime by default; the kubelet refreshes them by calling the TokenRequest API when they are about 80 percent through their life. During an API server outage that refresh fails, so a token can expire. The API server accepts tokens for their full lifetime, so a ten-minute outage is fine, but a multi-hour outage leaves in-cluster clients with expired tokens, and when the API server returns their first calls get 401 until the kubelet refreshes the file. Client libraries reread the file on each request, so it self-heals within a minute. Workloads that copy the token into memory once at startup, an older pattern, do not recover without a restart, which is why I always let the client library read the projected file.

"How would you test that your own workloads survive an API server outage?"

In a staging cluster I would block the API server from the nodes rather than stop it, because that mimics the common failure: a NetworkPolicy or an iptables rule on a node dropping traffic to the API endpoint, or on a managed cluster a security group change. Then I watch for three things. First, do any application Pods restart, which would mean their liveness probe or startup path calls the API. Second, do operators and autoscalers log errors and back off, or do they crash-loop. Third, does anything that uses in-cluster DNS keep working, since CoreDNS also depends on a watch and must serve from cache. I run this for longer than the token lifetime once, to catch the expired-token case. The pass criterion is zero user-visible errors and controllers that resume cleanly without manual intervention.

Drill · Pods and the object model

This group tests whether you know what each workload object guarantees — and, just as important, what it does not.

Q11. "Why is the Pod, not the container, the unit of scheduling? What do the containers in a Pod actually share?"

Reveal answer

Strong answer The containers in a Pod share a network namespace — one IP, one port space, so they reach each other on localhost — and an IPC namespace, and they can share volumes; they are placed on the same node, and they start and stop as a group. The Pod exists because a real deployable unit is often more than one process that must be co-located: an application plus a log shipper reading its files, or plus a proxy handling its TLS. Scheduling them separately could put them on different nodes, where they cannot share a filesystem or localhost. Putting them in one container instead would mean one process supervising others, which breaks the "one process per container" rule that makes restarts and images simple. So the Pod is the smallest thing that has an IP and a place; the container is the smallest thing that has an image and a process. What containers do not share by default is the process namespace (you can enable shareProcessNamespace) and the filesystem outside declared volumes. And a Pod's identity is not stable: it is never moved or healed, only replaced, which is why every higher-level object exists.

Land it The Pod is "one IP, one node, one lifecycle" — the smallest unit that can be placed, which is a different thing from the smallest unit that can be built.

Likely follow-ups
"How is the shared network namespace actually created and held open while containers restart?"

The kubelet asks the container runtime to create a Pod sandbox first, before any application container. In containerd that sandbox is the pause container, a tiny process whose only job is to hold the network namespace, the IPC namespace, and the cgroup for the Pod. The CNI plugin is invoked once against that sandbox to create the interface and assign the IP. Every application container is then started with its namespaces joined to the pause container's. That is why a container can crash and restart a hundred times and the Pod keeps its IP: the namespace belongs to pause, not to the application. If the pause container itself dies, the kubelet recreates the whole sandbox, the Pod gets a new IP, and every container restarts, which shows up as the event SandboxChanged.

"When would you put two application processes in one Pod, and when is that a mistake?"

Two processes belong in one Pod when they are a single unit of deployment and scaling and one is useless without the other: an application and its Envoy proxy, an application and the agent that ships its log files, a web server and a content-sync helper that writes into a shared emptyDir. The tests I apply are whether they must scale together, share a lifecycle, and communicate over localhost or a shared file. A mistake is co-locating two services because they talk a lot, such as an API and a worker or a service and its cache. They then cannot scale independently, a crash in one restarts the other's traffic, resource requests become a single lump, and one Deployment couples two teams' release cadences. Latency between two Pods on the same node is microseconds, so proximity is never the reason.

"What is shareProcessNamespace for, and what is the risk?"

With shareProcessNamespace true, all containers in the Pod see one process tree, so a debugging sidecar can run jstack against the JVM in the main container by PID, and a supervising container can send signals to a process in another. The pause container becomes PID 1 for the whole Pod, which also means it reaps zombies, a side benefit for images without a proper init. The risks are isolation ones: any container in the Pod can read another container's /proc/PID/environ, which often contains secrets passed as environment variables, and can kill its processes. Filesystems are still separate, but a process in a shared namespace can reach another container's root through /proc/PID/root. So I enable it only for debugging or for tightly trusted sidecars, and I prefer kubectl debug with --target for the ad-hoc case, which shares the namespace with a temporary ephemeral container only.

Q12. "Init containers versus native sidecar containers — what problem did the 1.33 sidecar feature solve that plain multi-container Pods could not?"

Reveal answer

Strong answer Init containers run one after another to completion before the app containers start — for schema migrations, waiting for a dependency, fetching a certificate. Ordinary containers in a Pod all start together with no ordering, and the Pod terminates when they all exit. That created two well-known races with helper containers. At startup, the application could make its first outbound call before the mesh proxy beside it was listening, and fail. At shutdown, the proxy could exit on SIGTERM before the application finished its in-flight requests, so the last requests failed; and in a Job, the application would finish but the proxy would keep the Pod alive forever, so the Job never completed. Native sidecar containers, stable since 1.33, are declared as init containers with restartPolicy: Always: they start in order before the app containers, must pass their startup probe before the next one starts, keep running for the Pod's life, restart if they crash, and are terminated after the app containers on shutdown, in reverse order. That gives helpers a defined place in the lifecycle instead of a race.

Land it A sidecar is "an init container that never finishes", and that one definition fixes both the startup race and the Job-never-completes bug.

Likely follow-ups
"How does a native sidecar affect a Job's completion and a Pod's termination grace period?"

For a Job, the Pod is considered complete when the regular containers have exited, regardless of the sidecar, and the kubelet then terminates the sidecar. That is the fix for the mesh-proxy-keeps-the-Job-alive bug. For termination, the kubelet sends SIGTERM to the regular containers first, waits for them to exit, then terminates sidecars in reverse order of declaration. All of this happens within the single terminationGracePeriodSeconds of the Pod, so a 30-second grace period is shared between the application's drain and the sidecar's shutdown. If the application uses 28 seconds, the proxy gets 2 before SIGKILL. In practice I size the grace period as application drain plus a few seconds for the sidecars, and I make sure the proxy is the last to go, so that the application's final outbound calls, such as flushing to Kafka, still have a route.

"What does the sidecar's startup probe gate, and what if the sidecar has no probe?"

The next init container, and eventually the application containers, do not start until the sidecar's startup probe succeeds; if there is no startup probe, the kubelet moves on as soon as the sidecar container is running, which for a proxy can be before it is actually listening. So for a mesh proxy I add a startup probe on its readiness endpoint, such as Envoy's port 15021 path /healthz/ready, with a budget of 30 seconds. The sidecar's readiness probe, separately, feeds into the Pod's Ready condition just like any other container's, so a proxy that later becomes unready takes the Pod out of endpoints. Its liveness probe restarts only the sidecar, not the Pod, and because it is an init container with restartPolicy Always, a crash restarts it in place while the application keeps running.

"Can you use native sidecars on a cluster older than 1.33, and what happens to the manifest?"

The feature was beta and enabled by default from 1.29, so on 1.29 to 1.32 it works as described as of Aug 2026 unless the cluster disabled the SidecarContainers feature gate. On anything older, the API server rejects restartPolicy Always on an init container as a validation error, so the manifest does not silently degrade; it fails to apply. That is a good property for a platform chart, because I can gate the sidecar form on the cluster version at render time and emit the old pattern, a regular container plus a preStop sleep and a startup wait script, for older clusters. What I check before relying on it is the mesh's own support: Istio added native sidecar injection behind an environment flag on the injector, ENABLE_NATIVE_SIDECARS, and Linkerd has an equivalent, so the mesh version matters as much as the Kubernetes version.

"Give an example of an init container that should stay an init container and not become a sidecar."

A schema migration runner, a one-shot fetch of a certificate from Vault into a shared emptyDir, or a permission fix on a mounted volume with chown. These do their work and must finish before the application starts, and there is nothing for them to do afterwards. Turning them into a sidecar would waste resources and, worse, would change semantics: a migration container that restarts on crash would rerun the migration. I would also keep a dependency-wait init container, one that loops until the database answers, as an init container, although I would question whether it should exist, because the application's own connection retry and readiness probe already express the same thing without a second image to maintain.

Q13. "Why does a Deployment manage ReplicaSets instead of Pods directly — and what exactly happens on kubectl rollout undo?"

Reveal answer

Strong answer A ReplicaSet answers one question: keep N Pods matching this template alive. A Deployment answers a different one: move from template A to template B safely. Separating them means each template version has its own ReplicaSet, identified by a hash of the Pod template in the pod-template-hash label. A rollout is then just the Deployment controller scaling the new ReplicaSet up and the old one down under the maxSurge and maxUnavailable rules, and the old ReplicaSet is kept at zero replicas — up to revisionHistoryLimit of them, ten by default. kubectl rollout undo does not restore YAML from anywhere: it copies the previous ReplicaSet's template back into the Deployment's spec, which creates a new revision whose hash matches the old ReplicaSet, so the controller scales that existing ReplicaSet back up — the same rolling process in reverse. Two consequences worth stating: a rollback is itself a rollout, subject to the same probes and budgets; and if your GitOps agent is watching, it will immediately re-apply the Git version, so the real rollback is a Git revert.

Land it Undo is "scale the old ReplicaSet back up", which is why it is fast and safe — and why it is a lie if Git still says the new version.

Likely follow-ups
"What does the pod-template-hash actually hash, and what happens if you change only a label?"

The hash is computed over the Pod template, spec.template, with the pod-template-hash label itself excluded, and then encoded into a short string. So any change to containers, images, environment, volumes, probes, or template labels and annotations creates a new hash and therefore a new ReplicaSet and a rollout. Changing only a template label is a rollout too, because the label is part of the template. Changing the Deployment's own metadata, its replicas, or the strategy fields does not change the hash and does not roll. This is also why the checksum-annotation trick for ConfigMaps works: the annotation lives on the template, so a new checksum is a new hash. And it is why kubectl rollout restart works: it writes a restartedAt annotation into the template, which is enough to change the hash.

"If revisionHistoryLimit is 10, can you undo to any of the last 10 versions?"

Yes, with kubectl rollout undo --to-revision=N, and kubectl rollout history lists the revisions with their change-cause annotation if anyone set it. The controller keeps the last ten ReplicaSets at zero replicas and deletes older ones. Two caveats. If two revisions have identical templates, undo to the older one produces a ReplicaSet whose hash matches an existing one, and the controller reuses it, so the revision numbers jump rather than repeat. And ten revisions is not ten days: a service deployed twenty times a day cycles its history in half a day, so for real audit history I rely on Git and the image registry, not on ReplicaSets. Some teams set revisionHistoryLimit to 2 or 3 to reduce object clutter, which is fine precisely because Git is the record.

"What are the consequences of changing a Deployment's selector?"

In apps/v1 the selector is immutable, so kubectl apply fails with a field-is-immutable error, and the fix is to delete and recreate the Deployment, which causes downtime unless done with --cascade=orphan followed by a recreate that adopts the Pods, as in the orphan scenario. The immutability exists because the selector is the contract between the Deployment, its ReplicaSets, and its Pods; changing it would orphan the existing ReplicaSets, which would still keep their Pods alive, and the new ReplicaSet would create a second full set. That is the double-fleet problem that the older extensions/v1beta1 API allowed. The practical lesson is to choose selector labels once, keep them minimal such as app and component, and put anything that changes, like version, in template labels only.

Q14. "Labels versus annotations versus ownerReferences — what is each for, and how does garbage collection use them?"

Reveal answer

Strong answer Labels are short key-value pairs meant for selection: Services, ReplicaSets, NetworkPolicies, and PDBs all find their Pods by label selector, so labels are load-bearing and must be stable and small (63-character values). Annotations are for data that nothing selects on: a description, the last-applied configuration, a checksum of a ConfigMap to force a restart, controller-specific settings. They can be large and arbitrary. ownerReferences live in metadata and record which object created this one — a Pod points at its ReplicaSet, which points at its Deployment. The garbage collector uses them: when an owner is deleted, dependents are deleted too, in one of three modes. background (the default) deletes the owner immediately and cleans up dependents afterwards; foreground deletes dependents first and the owner last, blocking the owner with a finalizer; orphan removes the reference and leaves the dependents alive. That is what kubectl delete --cascade=orphan does. The trap: a selector that accidentally matches Pods from another Deployment makes that ReplicaSet think it has too many, and it will delete them — ownerReferences prevent that in the common case, because a ReplicaSet only adopts Pods without an owner.

Land it Labels are for finding, annotations are for describing, and ownerReferences are for cleaning up — muddle the first and something gets deleted that you did not mean to delete.

Likely follow-ups
"Give the exact label a ReplicaSet uses to avoid adopting another Deployment's Pods."

The pod-template-hash label. The Deployment controller adds it to both the ReplicaSet's selector and its template, so two Deployments with the same app label still have ReplicaSets whose selectors differ by hash and cannot match each other's Pods. Adoption then requires two things: the Pod matches the selector including the hash, and it has no controller ownerReference, or its ownerReference points at this ReplicaSet. A Pod owned by someone else is never adopted. The real risk is a hand-written ReplicaSet or a bare Pod with the same labels and no owner, which will be adopted and then counted, and possibly deleted, by the ReplicaSet. For that reason a platform policy should forbid bare Pods in production namespaces, and label selectors should always include a component-specific key.

"How does garbage collection deal with a cross-namespace or cluster-scoped owner?"

It refuses them, and this matters for operators. An ownerReference has no namespace field, so a namespaced dependent can only point at an owner in the same namespace or at a cluster-scoped owner. A cluster-scoped object cannot have a namespaced owner. If I write an ownerReference that breaks those rules, the garbage collector treats it as invalid, logs a warning event on the dependent, and since 1.20 may delete the dependent as if its owner did not exist, which has surprised people who tried to make a cluster-scoped custom resource own namespaced Secrets. The right pattern for cross-namespace cleanup is a finalizer on the owner whose controller deletes the dependents itself, or a label that the controller uses to find and delete them.

"What does the blockOwnerDeletion field do?"

It is part of foreground deletion. When an owner is deleted with propagationPolicy Foreground, the API server adds the foregroundDeletion finalizer to it and the garbage collector deletes dependents first. Only dependents whose ownerReference has blockOwnerDeletion true actually hold the owner in place; the others are deleted but do not block. Controllers set it true on the children they create, which is why deleting a Deployment in the foreground waits for the Pods. There is a permission subtlety: setting blockOwnerDeletion on an object requires update rights on the owner's finalizers subresource, enforced by the OwnerReferencesPermissionEnforcement admission plugin where enabled, so an operator's ServiceAccount needs update on myresource/finalizers or the API server strips or rejects the field.

"When would you deliberately delete something with cascade set to orphan?"

When I need to replace a controller without touching the Pods. The classic case is changing an immutable field such as a Deployment's selector or converting a Deployment into a StatefulSet-like custom resource: delete the Deployment with --cascade=orphan, so the ReplicaSet and Pods stay up and serving, then create the new owner with a selector that matches those Pods so it adopts them, and let a normal rollout replace them over time. Another use is preserving evidence during an incident, deleting a misbehaving Job so it stops retrying while keeping its failed Pod for logs. Both are surgical, and I would always follow with a check that ownerReferences were re-established, because orphans are unmanaged the whole time in between.

Q15 · Scenario. "Someone deleted a Deployment in production, but the Pods are still running and serving. Two hours later they are still there. Explain, and tell me how to get back to a managed state without downtime."

Reveal answer

Strong answer In diagnosis order: the symptom says the Pods outlived their owner, which means the delete was done with orphan cascading — kubectl delete deploy orders --cascade=orphan, or an older client where that was the default for some paths — or the garbage collector is not running (a controller manager problem, which I would check first with kubectl get rs: if the ReplicaSet is also still there, the collector never ran). Evidence: kubectl get pods -o yaml and look at metadata.ownerReferences; orphaned Pods have none. Those Pods are now unmanaged — if one crashes, nothing replaces it, and no rollout can touch them. The recovery: re-apply the Deployment from Git with the same selector labels. The new ReplicaSet's controller will find Pods matching its selector with no owner and adopt them, provided their template hash matches; if the template differs, it will create new Pods and the adopted or unmatched old ones will be scaled away through a normal rollout. Either way there is never a moment with zero Pods, because the old ones keep serving until the new ones are Ready. Prevention: RBAC that denies delete on Deployments to humans in production, and GitOps so that a deleted object is recreated within minutes by the agent.

Land it Orphaned Pods are a time bomb rather than an outage — the fix is to recreate the owner with a matching selector and let adoption do the work.

Likely follow-ups
"You re-applied the Deployment and it created a full new set of Pods instead of adopting. Why, and what now?"

Adoption needs the orphaned Pods to match the new ReplicaSet's full selector, which includes the pod-template-hash. If the manifest in Git differs from what those Pods were built from, even by an image tag or an environment variable, the hash differs, so the new ReplicaSet matches nothing and creates a full set. The orphaned Pods still have no owner, so they keep serving alongside the new ones at double capacity. Nothing is broken, but I have to remove them deliberately. I would wait until the new ReplicaSet is fully Available, then delete the orphans one at a time with kubectl delete pod, which goes through normal graceful termination, so traffic shifts without errors. Because they have no owner nothing recreates them, and after the last one is gone the fleet is fully managed again.

"How do you prove, after recovery, that everything is managed and nothing is duplicated?"

I check three counts agree. kubectl get deploy shows desired, ready, and up-to-date; kubectl get rs shows exactly one ReplicaSet with a non-zero count; and kubectl get pods -l app=orders -o custom-columns with a column for metadata.ownerReferences[0].name shows every Pod pointing at that ReplicaSet. Any Pod with an empty owner column is still orphaned. I also compare the number of endpoints in the EndpointSlice with the Deployment's ready count, because an orphan that is Ready still receives traffic and would inflate that number. Finally I check the HPA, if any, because it scales the Deployment's replicas and did not know about the orphans, so the fleet may be bigger than the HPA's view until the orphans are gone.

"What would have prevented the two-hour gap in noticing?"

An alert that compares what should exist with what does. Two cheap signals: kube_pod_owner from kube-state-metrics has an owner_kind label, so a rule that fires on Pods in production namespaces whose owner_kind is empty or Node catches orphans and stray bare Pods within a minute. And a GitOps agent with self-heal would have recreated the Deployment within its sync interval, typically three minutes, and adopted the Pods, turning a two-hour exposure into a three-minute one and logging the drift. On the prevention side, RBAC that removes delete on deployments from human roles in production, and an audit-log alert on any delete of a workload object by a human identity, so the action is visible even when it is authorised.

Q16. "What does a StatefulSet guarantee that a Deployment does not, and what does it still not guarantee?"

Reveal answer

Strong answer A StatefulSet gives each Pod a stable identity in three forms. A stable name with an ordinal: kafka-0, kafka-1. A stable network name through a headless Service, so kafka-0.kafka.data.svc.cluster.local always resolves to whichever node is currently running that Pod. And stable storage: each ordinal gets its own PersistentVolumeClaim from volumeClaimTemplates, and when the Pod is rescheduled, the same claim — and the same disk — is reattached. It also orders operations: by default Pods are created 0, 1, 2 and each must be Ready before the next starts, and deleted in reverse; podManagementPolicy: Parallel relaxes that. What it does not guarantee: it does not replicate data — the application does that; it does not guarantee at-most-one — if a node is partitioned, the controller will not create a replacement kafka-0 until the old Pod is confirmed deleted, which can require manual force-deletion and is where split-brain risk lives; and rolling updates are ordinal-ordered but still subject to your probes being honest. Deleting a StatefulSet does not delete its PVCs, which is a safety feature and a source of forgotten disks.

Land it A StatefulSet promises identity and ordering, not data safety — the database still has to do its own replication and the operator has to handle the stuck-node case.

Likely follow-ups
"What happens to the PersistentVolumeClaim when you scale a StatefulSet down and back up?"

By default the claim stays. Scaling from three to two deletes kafka-2 but leaves its PVC, and scaling back up recreates kafka-2 and reattaches the same disk with its data intact, which is what you want for a broker that will rejoin the cluster. Since 1.32 the persistentVolumeClaimRetentionPolicy field is stable and lets me change that: whenScaled Delete removes the PVC on scale-down, and whenDeleted Delete removes them when the StatefulSet is deleted. I set whenDeleted Delete in test environments and keep Retain everywhere else. The cost of Retain is forgotten disks: a decommissioned StatefulSet leaves three volumes billing forever, so I have a monthly report of PVCs with no Pod that mounts them, using kube_persistentvolumeclaim_info joined against Pod volumes.

"Why does the headless Service matter, and what does a normal Service on a StatefulSet do differently?"

The headless Service, one with clusterIP None, is what makes the per-Pod DNS names exist. DNS returns the individual Pod IPs, and each Pod gets a record kafka-0.kafka.data.svc.cluster.local because the StatefulSet sets spec.subdomain and hostname on each Pod to match. Without it the Pod names are stable but not resolvable. A normal Service with a cluster IP on the same Pods works too and gives load-balanced access to any replica, which suits reads on a replicated database but is wrong for anything that must address a specific member, such as a Kafka client connecting to the leader for a partition. Most stateful deployments have both: the headless one for peer discovery and the ordinal names, and a normal one, often only for the read path or for tooling.

"A node is partitioned and kafka-0 is on it. What exactly happens and what do you do?"

The node goes NotReady after the grace period; after the default 300-second toleration its Pods are marked for deletion. For a Deployment the ReplicaSet creates a replacement immediately, but the StatefulSet controller will not create a new kafka-0 while the old Pod object still exists in Terminating, because the kubelet on the partitioned node cannot confirm the container is dead. That is at-most-one semantics protecting me from two brokers claiming the same identity. What I do depends on whether I can prove the node is dead. If the cloud says the instance is terminated, I can delete the Node object, which removes the Pods, or force-delete the Pod with --grace-period=0 --force. If the node might still be running, force deletion is exactly the split-brain risk, so I wait, or fence the node by stopping the instance, and only then force-delete. A Kafka with replication factor three tolerates the wait.

"When should you not use a StatefulSet for a stateful application at all?"

When the application needs more lifecycle logic than ordering and stable names. A database that must promote a replica on failover, rebalance data on scale-out, or take coordinated backups needs an operator, and the mature ones, such as CloudNativePG for Postgres or Strimzi for Kafka, either use a StatefulSet underneath or manage Pods directly with their own controller. I also would not use a StatefulSet for a service that merely wants a per-instance cache on local disk, because a Deployment with an emptyDir is simpler and the identity is not needed. And for a managed cloud database I would not run it in the cluster at all; the StatefulSet is the right shape only when the team is committed to operating the data store itself.

Q17. "How does a DaemonSet get a Pod onto every node, including tainted control-plane or GPU nodes, and what happens when a new node joins?"

Reveal answer

Strong answer The DaemonSet controller creates one Pod per eligible node and sets a node affinity on each Pod pinning it to that node; since 1.12 the default scheduler places them rather than the controller bypassing it, so resource requests and taints are respected consistently. Eligibility comes from the DaemonSet's nodeSelector or affinity plus its tolerations. Nodes are commonly tainted — control-plane nodes with node-role.kubernetes.io/control-plane:NoSchedule, GPU nodes with a custom taint — so a DaemonSet that must run everywhere, like a CNI plugin or a log shipper, declares tolerations for those taints, often operator: Exists to tolerate everything. The controller also adds tolerations automatically for the node-condition taints (not-ready, unreachable, disk-pressure, memory-pressure) so that daemons keep running on a struggling node — the monitoring agent must survive exactly the conditions it reports. When a node joins, the controller sees the new Node object and creates a Pod for it within seconds, which is how a cluster autoscaler's new node gets its networking and logging before workloads land. Updates use a rolling strategy with maxUnavailable across nodes, or OnDelete for daemons you upgrade manually.

Land it A DaemonSet is "one Pod per node, tolerating the conditions that would evict anything else" — which is why it is the right shape for the agents that keep the node observable.

Likely follow-ups
"A DaemonSet Pod is missing on one node and no event explains it. What do you check?"

First kubectl describe daemonset for the desired versus current counts and any events. Then kubectl get node with labels and taints, because eligibility is the usual reason: the node carries a taint the DaemonSet does not tolerate, or lacks a label its nodeSelector needs. Next, resources: since DaemonSet Pods go through the scheduler, a node that is fully requested has no room, and the Pod exists but is Pending with a FailedScheduling event, which is why I list Pods with a field selector on the DaemonSet's label and look for Pending ones. If there is no Pod object at all for that node, I suspect the controller is not running, or a maxSurge or maxUnavailable rolling update is holding it back. Lastly I check the node's Ready condition, since a node that is not Ready still gets the Pod created but not started.

"How do you roll out a DaemonSet change to 500 nodes without taking the logging agent down everywhere?"

With updateStrategy RollingUpdate and a deliberate maxUnavailable, which is 1 by default, meaning one node's Pod at a time. On 500 nodes that takes a long time, so I set maxUnavailable to a percentage such as 10 percent, or use maxSurge, which has been stable since 1.25 and starts the new Pod alongside the old one on the same node, which requires the daemon to tolerate two copies briefly, for example by not binding a host port. I also set minReadySeconds to 30 so a new Pod that starts but immediately fails does not count as done and the rollout halts. For a daemon whose restart is risky, such as the CNI agent, I use OnDelete and drive the rollout node by node from a script that checks each node's health between deletions.

"How does a DaemonSet Pod survive a node under memory pressure when everything else is evicted?"

Three things stack. The controller automatically adds tolerations for the memory-pressure and disk-pressure taints, so the Pod is not evicted by the taint mechanism. The kubelet's eviction ranking then decides among the remaining Pods by usage over request, then priority; a DaemonSet Pod with a PriorityClass of system-node-critical sits at the bottom of the list, and the kubelet also refuses to evict a Pod whose usage is within its request. So the recipe is a tight, honest memory request equal to its limit and the system-node-critical class. What tolerations do not do is protect against the kernel OOM killer if the Pod exceeds its own limit, and they do not create capacity, so a DaemonSet with a large request can itself be the reason a node has no room for workloads.

Q18. "Explain a Job's completions, parallelism, backoffLimit, and podFailurePolicy — and how you would run 10,000 independent tasks without 10,000 Pods."

Reveal answer

Strong answer A Job runs Pods until a number of them succeed. completions is how many successful Pod runs are needed; parallelism is how many may run at once; backoffLimit is how many failed Pods the Job tolerates before it gives up and is marked Failed, with exponential back-off between retries. podFailurePolicy, stable since 1.31, lets me say "an exit code of 42 means bad input, fail the Job immediately without retrying" or "a Pod evicted by a node drain does not count against the back-off", which stops infrastructure noise from burning retries. For 10,000 tasks, the wrong design is 10,000 Jobs or one Job with completions 10,000 — that is 10,000 Pod objects churning through the API server and etcd. The right shape is an Indexed Job: completionMode: Indexed with, say, 200 completions and parallelism 20, where each Pod reads its index from JOB_COMPLETION_INDEX and processes tasks 50 at a time from a partition, or simply a Job with parallelism 20 and no fixed completions whose Pods pull from a queue until it is empty. Add ttlSecondsAfterFinished so finished Jobs and Pods are cleaned up, and activeDeadlineSeconds as a global timeout.

Land it A Pod is the unit of scheduling, not the unit of work — batch each Pod's work up so the API server sees hundreds of objects, not tens of thousands.

Likely follow-ups
"How does an Indexed Job handle one index failing, and what does backoffLimitPerIndex add?"

In a plain Indexed Job, a failed Pod for index 17 is retried with a new Pod for the same index, and the shared backoffLimit counts every failure across all indexes, so a few bad partitions can exhaust the budget and fail the whole Job. backoffLimitPerIndex, stable since 1.33, gives each index its own retry budget, and maxFailedIndexes says how many indexes may fail before the Job as a whole is marked failed. The Job's status then lists failedIndexes, so I know exactly which partitions to rerun. That is the right shape for data processing where one corrupt record should not stop the other 199 partitions. Combined with a podFailurePolicy that marks a specific exit code as FailIndex, a bad-input partition is failed immediately without burning retries.

"Pods pull from a queue with no fixed completions. How does the Job know when it is done?"

In that mode, completions is unset and the Job is complete when any one Pod exits successfully; after that the controller stops creating new Pods and waits for the running ones to finish. So the worker has to exit zero only when the queue is empty, and exit non-zero, or keep looping, otherwise. The pattern is a worker loop that receives with a short wait, processes, acknowledges, and on an empty receive checks a queue depth and exits zero if it is zero. The subtlety is a worker that hits an empty queue moment while another worker's message is in flight; if it exits, the Job is marked complete while work remains. I handle that with a queue that reports in-flight counts, or with a small final grace of a few empty polls before exiting.

"What does the Job do when a Pod is evicted by a node drain during a spot interruption?"

By default, an evicted Pod counts as a failure against backoffLimit, so a batch that runs on spot nodes can fail after a few interruptions with no application error at all. podFailurePolicy fixes it with a rule of action Ignore on the condition DisruptionTarget, which the kubelet and the eviction API set on Pods that are being disrupted deliberately. The Job then creates a replacement Pod without counting the failure. For the work itself, the task must be idempotent, because the interrupted Pod may have half-finished; with a queue, the message becomes visible again after its visibility timeout, and the deterministic output key means a rerun overwrites rather than duplicates. I also set terminationGracePeriodSeconds long enough for the Pod to finish its current item in the two-minute spot warning.

"What breaks if 10,000 tasks become 10 million?"

The Job object itself stops being the right unit. Even with batching, the Job status tracks completed indexes, and its status field has size limits; a million-completion Indexed Job produces a huge status object and heavy controller load. At that scale I would keep the Job at a fixed shape, say 500 workers pulling from a queue, and move all bookkeeping into the queue and a results table. Then Kubernetes only sees 500 Pods regardless of task count. The other pressure points are the API server, which sees Pod churn if workers are short-lived, so workers should be long-lived and loop; the container registry, which 500 simultaneous pulls will rate-limit, so I pre-pull or use a pull-through cache; and the queue's throughput, which at 10 million items needs batching of receives.

Q19 · Scenario. "A nightly CronJob that reconciles payments ran twice last night, three minutes apart, and double-charged 40 customers. Explain how that can happen and how to prevent it."

Reveal answer

Strong answer Diagnosis order: first, evidence — kubectl get jobs for the CronJob shows the Job objects with their creation times, and the CronJob's events show whether it created two Jobs or one Job ran two Pods. Likely causes, ranked. One: the previous night's run was still going at the scheduled time and concurrencyPolicy is Allow, the default, so a second Job started alongside it. Two: the first Pod failed partway — perhaps evicted or OOM-killed after charging some customers — and the Job's backoffLimit retried it with a fresh Pod that started over; that gives exactly "three minutes apart". Three: a controller manager restart or a clock issue around the schedule time led the CronJob controller to consider a run missed and start it again within startingDeadlineSeconds. The fix has two halves. On the Kubernetes side: concurrencyPolicy: Forbid, a sensible startingDeadlineSeconds such as 300, and a podFailurePolicy that does not retry on application failures. On the application side, which is the real fix: the reconciliation must be idempotent, keyed on a run identifier or a per-customer ledger entry, so a rerun charges nobody twice — Kubernetes guarantees at-least-once for Jobs, never exactly-once. Prevention: an idempotency test in CI that runs the job twice against the same fixture.

Land it Jobs are at-least-once by contract, so the double charge is an application bug that Kubernetes settings can make rarer but never impossible.

Likely follow-ups
"You set concurrencyPolicy Forbid and it happened again. What did you miss?"

Forbid only stops two Jobs from being created at once; it does nothing about a single Job running two Pods. So the second case, a Pod that failed partway and was retried by the Job's backoffLimit, is still open. I would confirm from kubectl get pods for the Job, which will show a Failed or Evicted Pod followed by a fresh one three minutes later. The fix is backoffLimit 0 with restartPolicy Never for any non-idempotent job, so a failed Pod fails the Job and pages a human instead of retrying. The other miss would be a second CronJob object, for example one left in a different namespace after a migration, or two clusters both running the schedule against the same database. That is why the real fix is idempotency in the reconciliation itself; every Kubernetes setting is only a reduction in likelihood.

"What does startingDeadlineSeconds do, and how can it cause a burst of runs?"

startingDeadlineSeconds is how long after the scheduled time the controller may still start a missed run. If it is unset, a run missed while the controller was down is started whenever the controller notices, however late. If the controller finds more than 100 missed schedules since the last run and no deadline is set, it refuses and logs "too many missed start times", which is a silent stop. With a deadline set, only schedules within the deadline window count. So a five-minute deadline on a job that runs every minute can start up to five catch-up runs at once, and with concurrencyPolicy Allow they run simultaneously. For a nightly job I set startingDeadlineSeconds to something like 600, so a controller blip still runs the job once, but a day-old miss does not run at noon.

"How would you make the payments reconciliation itself idempotent?"

Give every run a deterministic identity, such as the business date, and record each charge with a unique key derived from that identity and the customer, for example the pair run_date and customer_id as a unique constraint in a charges table. The job inserts the ledger row first, in the same transaction as any local state, and only then calls the payment provider with an idempotency key equal to that row's key, which every serious provider supports, so even a retried call after a timeout is not double-charged. A rerun then hits the unique constraint and skips the customer. I also make the job resumable by marking each customer as done, so a retry after a crash continues rather than starting over. The test in CI runs the job twice against the same fixture and asserts the charge count is unchanged.

"How do you make sure the job runs at all, and that you know if it did not?"

Two signals. The CronJob's status has lastScheduleTime and lastSuccessfulTime, and kube-state-metrics exports them, so an alert that fires when time since kube_cronjob_status_last_successful_time exceeds 26 hours catches a nightly job that silently stopped. The second is a business-level check that does not trust Kubernetes: the job writes a completion record with the business date, and a separate monitor queries for yesterday's record every morning. I also keep successfulJobsHistoryLimit and failedJobsHistoryLimit at a few each so the last Pods' logs are available. The subtle failure this catches is a CronJob with suspend true left over from an incident, which stops scheduling entirely and is easy to forget.

Q20 · Design. "Design a system on Kubernetes that renders 500,000 PDF invoices every month-end within a four-hour window, using CPU-heavy workers, without disturbing the online services on the same cluster."

Reveal answer

Strong answer Requirements: 500,000 renders in 4 hours is about 35 per second; at, say, 2 seconds of CPU per render that is roughly 70 cores of work for four hours, which must not steal from online traffic. Design: put the invoice identifiers into a queue (SQS, or a Postgres table with SELECT ... FOR UPDATE SKIP LOCKED as the Database Primer describes) and run a Job with parallelism around 80 and no fixed completions, whose Pods pull batches until the queue is empty and exit zero. Isolate them: a dedicated node pool with a taint workload=batch:NoSchedule that only these Pods tolerate, scaled by the cluster autoscaler or Karpenter from zero at month-end and back to zero after, ideally on spot instances since the work is retryable. Give the Pods Guaranteed QoS with a CPU limit, because here predictability matters more than burst, and a low PriorityClass so that if anything ever does share a node, the online services win. Make each render idempotent (write the PDF to object storage under a deterministic key) so retries and spot interruptions are harmless, and set activeDeadlineSeconds to a bit under four hours with an alert. What I would not do: run this as a CronJob with 500,000 completions, share the online node pool and rely on requests alone, or use an HPA on a Deployment — a Deployment has no notion of "finished".

Land it Batch work gets its own tainted, autoscaled, spot-backed pool and a queue-driven Job — separation by node, not by hope.

Likely follow-ups
"The requirement changes: the window is now one hour, not four. What changes in the design?"

The arithmetic quadruples: roughly 140 renders per second and about 280 cores of work for the hour. The queue-driven Job still fits, but parallelism goes to around 320 and node provisioning becomes the critical path, because Karpenter or the cluster autoscaler needs several minutes to bring up dozens of nodes and each node has to pull the worker image. So I pre-scale the pool 15 minutes before the window with a KEDA cron scaler or a scheduled change to the node group minimum, and I use a small worker image on a pull-through cache. I would also check the downstream limits, since 140 PDFs per second into object storage and the invoice database are new bottlenecks. If a one-hour window proves impossible, the honest design is to start rendering earlier for invoices whose data is final, which is a product conversation, not a cluster one.

"What would you cut if you had two days to build this?"

I would cut the dedicated spot pool and Karpenter configuration, and run the Job on the existing general pool with a low PriorityClass, a tight Guaranteed request, and a ResourceQuota on its namespace capped at, say, 30 percent of the cluster, accepting that month-end costs more and takes longer. I would keep the queue, idempotent output keys, and activeDeadlineSeconds, because those are what make the job safe to retry and impossible to run away. I would also keep the alert on progress, a simple metric of rendered count per minute. What I would explicitly not cut is the isolation by priority, because without it a batch that grabs the whole cluster becomes an online outage, and that is the one failure the requirement forbids.

"The job started and the online services' latency rose anyway. What happened?"

The taint kept the Pods on their own nodes, so the interference came through something shared. Ranked candidates: the queue or the invoice database itself, because 80 workers hammering Postgres for invoice data slows every online query, which shows as database latency rather than CPU; the network, where 35 PDFs per second to object storage plus pulls saturate a NAT gateway or a shared egress; a DaemonSet such as the log shipper flooding the logging pipeline with worker output; and the API server, if the workers were short-lived Pods rather than long-lived loops. I would confirm by looking at where the online services' time went, database wait or network, not CPU. The fix is rate limiting at the shared resource: a connection pool cap for workers, a read replica for invoice data, and batching of storage writes.

"Why a Job and not a Deployment scaled by KEDA on queue depth?"

A Deployment plus KEDA is a reasonable alternative and is the better shape if the work is continuous. KEDA scales a Deployment from zero to N on the SQS queue length and back down, and the workers are the same loop. What it lacks is the notion of completion and the built-in accounting: a Job knows it failed, has activeDeadlineSeconds as a hard stop, records how many Pods failed, and integrates with podFailurePolicy. With a Deployment, a poisoned message that crashes every worker becomes an endless crash loop that KEDA keeps scaling, and there is no single object whose status says "month-end finished". For a bounded monthly batch I prefer the Job; for a queue that always has traffic, KEDA on a Deployment, with a dead-letter queue to catch the poison.

Drill · Scheduling

These questions test whether you can predict where a Pod lands, why it did not land anywhere, and how to steer placement without fighting the scheduler.

Q21. "What does the scheduler actually compute? Explain filtering and scoring with examples of each, and what happens when scoring ties."

Reveal answer

Strong answer For each unscheduled Pod the scheduler runs a pipeline of plugins in two phases. Filtering asks every node a yes-or-no question and removes the ones that say no: does the node have unreserved CPU and memory at least equal to the Pod's requests (NodeResourcesFit); does it match the Pod's nodeSelector and required node affinity; does the Pod tolerate every taint on the node; is a requested host port free; can the Pod's volume be attached in this node's zone; would anti-affinity or a topology spread constraint be violated. If no node survives, the Pod stays Pending with an event listing which filter rejected how many nodes — that message is the first thing to read. Scoring then ranks the survivors from 0 to 100 per plugin, weighted and summed: prefer nodes where the Pod's image is already cached, prefer spreading replicas across zones and nodes, prefer balanced resource usage (or, with a bin-packing profile, prefer the fullest node so the autoscaler can remove empty ones), and honour preferred affinity weights. Ties are broken randomly among the top-scoring nodes, which is why identical Pods land on different nodes without any explicit spread. On a large cluster the scheduler only scores a sample — by default enough to cover about 50 percent of nodes, at least 100 — which is why "it did not pick the obviously best node" can be true and harmless.

Land it Filtering is about "can it run here", scoring is about "should it" — and a Pending Pod always failed the first, so read the filter counts in its event before touching anything.

Likely follow-ups
"How many nodes does the scheduler score, exactly, and what is the flag?"

The setting is percentageOfNodesToScore in the scheduler configuration. As of Aug 2026 the default is adaptive: on clusters up to about 100 nodes it scores every feasible node; above that, the percentage falls linearly from 50 percent down to a floor of 5 percent at around 5,000 nodes, and there is always a minimum of 100 nodes scored where that many exist. So on a 1,000-node cluster the scheduler stops filtering once it has found roughly 400 feasible nodes and scores only those. The consequence is that placement is good, not optimal, and it is deliberate: scoring every node on a large cluster would cut scheduling throughput from hundreds of Pods per second to a handful. If a team insists on the best node every time, I set the percentage to 100 and accept the slower scheduler on a small cluster.

"Can you change the weights, and when would you want a bin-packing profile?"

Yes, through a KubeSchedulerConfiguration with named profiles. The NodeResourcesFit plugin's scoringStrategy can be LeastAllocated, the default, which spreads Pods across nodes, or MostAllocated, which packs them, and RequestedToCapacityRatio for custom curves. Bin-packing makes sense when the cluster autoscaler or Karpenter is expected to remove empty nodes: spreading keeps every node partly used and nothing can be removed, packing empties nodes so they are scaled away and the bill drops. The trade-off is blast radius and hot nodes: packing puts more replicas of the same service on one machine, so I pair it with a topology spread constraint on hostname for services that need it. On a managed cluster I usually cannot change the default scheduler's profile, which is one argument for Karpenter's consolidation feature doing the packing after the fact.

"Why did the scheduler put a Pod on a node whose actual CPU usage was 90 percent?"

Because it does not look at usage. Every filter and score works on requests summed against allocatable, and a node whose Pods request little but use a lot looks empty to the scheduler. This is the single most common misunderstanding about placement. The fix is honest requests, so that bookkeeping tracks reality, and the tooling for that is the Vertical Pod Autoscaler in recommendation mode. If usage-aware scheduling is a real need, the scheduler-plugins project has a Trimaran plugin set that scores nodes by actual utilisation from metrics, but it is an add-on with its own deployment and I have only seen it justified on batch clusters. The descheduler's LowNodeUtilization strategy is the after-the-fact version, evicting Pods from hot nodes so they land elsewhere.

"How fast is the scheduler, and what would make it the bottleneck?"

A single scheduler instance places on the order of a hundred Pods per second on a mid-size cluster, and it is a single active instance with leader election, so it does not scale out. What slows it is expensive plugins: required pod anti-affinity is the classic, because it compares each candidate node against every Pod matching the affinity terms, which is quadratic on big clusters; large numbers of topology spread constraints and inter-Pod affinity rules with many terms add up similarly. The scheduler exposes scheduler_scheduling_algorithm_duration_seconds and scheduler_pending_pods, and a growing pending queue with high algorithm latency is the signature. In a batch-heavy cluster that creates thousands of Pods a minute, the remedy is fewer affinity rules, Indexed Jobs that create fewer Pods, or a second scheduler profile with a lighter plugin set for batch Pods.

Q22. "Taints and tolerations versus node affinity — they both influence placement. When do you use which, and what do NoSchedule, PreferNoSchedule, and NoExecute do differently?"

Reveal answer

Strong answer They point in opposite directions. Node affinity is a property of the Pod saying "I want nodes like this" — a Pod attracts itself to nodes. A taint is a property of the node saying "nothing may come here unless it explicitly tolerates me" — a node repels Pods. Use a taint when you want to reserve nodes: GPU nodes, batch pools, control-plane nodes, nodes for one tenant. Nothing lands there by accident, because a Pod has to opt in with a toleration. Use affinity when the Pod has a preference or a requirement but the node is otherwise general-purpose. To dedicate a pool properly you use both: the taint keeps others out, and the affinity keeps the intended Pods in, since a toleration alone only permits, it does not attract. The three effects: NoSchedule blocks new placements but leaves running Pods; PreferNoSchedule is a soft version the scheduler tries to honour; NoExecute also evicts running Pods that do not tolerate it, optionally after tolerationSeconds — which is the mechanism the Node controller uses for unreachable nodes, with the default five-minute tolerance that every Pod gets automatically.

Land it Taints say "keep out", affinity says "come here", and dedicating a node pool needs both sides of that conversation.

Likely follow-ups
"What is the default toleration every Pod gets, and how would you change it for one workload?"

The DefaultTolerationSeconds admission plugin adds two tolerations to every Pod that does not already have them: node.kubernetes.io/not-ready and node.kubernetes.io/unreachable, both with effect NoExecute and tolerationSeconds 300. That is why a Pod on a dead node is evicted after five minutes and not immediately. For a stateless service where five minutes of a dead replica is too long, I set those tolerations explicitly in the Pod spec with tolerationSeconds 30, and the Pod is evicted 30 seconds after the taint appears. For a stateful workload where a false positive would be worse than a wait, I set a longer value or omit tolerationSeconds so it is never evicted by that taint. The cluster-wide defaults are API server flags, --default-not-ready-toleration-seconds and --default-unreachable-toleration-seconds, which I rarely touch.

"Why do you need affinity as well as a taint to dedicate a pool? Give the failure without it."

A toleration says a Pod may go on a tainted node; it does not say it must. So a GPU inference Deployment with only a toleration for the GPU taint is still eligible for every general node, and the scheduler will happily place it on a cheap general node where it either fails to find a GPU resource or, if the GPU request is missing, runs on CPU and is slow without anyone noticing. Conversely a batch Pod tolerating the batch taint can land on the online pool, exactly what the taint was meant to prevent. The affinity closes that gap: a required nodeAffinity on the pool label makes the Pod refuse every other node. I put the pair, toleration plus required affinity, together in the platform chart under one value, such as nodePool batch, so a team cannot set one without the other.

"How would you drain a node without kubectl drain, using taints?"

Add a NoExecute taint to the node, for example kubectl taint node worker-7 maintenance=true:NoExecute, and every Pod without a toleration for it is evicted through the eviction API, which respects PodDisruptionBudgets, and its controller recreates it elsewhere. Then cordon or delete the node. This is what the Node controller does for unreachable nodes and what some autoscalers use. The differences from kubectl drain are that drain first cordons to stop new placements, whereas a NoExecute taint also blocks new placements implicitly since new Pods will not tolerate it, and drain waits for completion and handles DaemonSet Pods and emptyDir warnings explicitly, so it is the better tool interactively. The taint approach shines when I want an automated, declarative drain that a controller applies to many nodes with a label.

Q23. "Pod anti-affinity or topologySpreadConstraints for spreading replicas across zones? Explain the difference and the cost of each at scale."

Reveal answer

Strong answer Pod anti-affinity is pairwise: "do not put this Pod on a node — or in a zone, depending on topologyKey — where a Pod with these labels already is". Required anti-affinity with a zone key and three replicas means exactly one per zone, and a fourth replica cannot be scheduled at all, which is a common surprise when the HPA scales up. It is also expensive: the scheduler must check every candidate node against every existing Pod with matching labels, which is quadratic and was a known performance problem on clusters with thousands of Pods. Topology spread constraints express a distribution instead: "across zones, the difference between the most and least populated zone for these Pods must be at most maxSkew", with whenUnsatisfiable set to either refuse (DoNotSchedule) or do the best it can (ScheduleAnyway). Six replicas across three zones become two per zone, ten become four-three-three, and scaling never gets stuck. It is cheaper to evaluate and it is what the cluster's default profile applies to every Pod at a soft level anyway. I use anti-affinity only for the genuinely pairwise case — two replicas of a leader-election pair must not share a node — and spread constraints for everything about distribution.

Land it Anti-affinity answers "never together", spread constraints answer "evenly" — and only the second one keeps working when replicas outnumber zones.

Likely follow-ups
"Write the topology spread constraint you would put in the base chart, and explain each field."

I would add two constraints. The first has topologyKey topology.kubernetes.io/zone, maxSkew 1, whenUnsatisfiable DoNotSchedule, and a labelSelector matching the service's app label; that guarantees the replicas never differ by more than one between zones, and with three zones a zone loss removes at most about a third. The second has topologyKey kubernetes.io/hostname, maxSkew 1, and whenUnsatisfiable ScheduleAnyway, so replicas prefer separate nodes but scale-up is never blocked when the cluster is tight. Two fields people miss: minDomains, which stops the scheduler treating a single zone as "balanced" when the other zones have no nodes yet, and matchLabelKeys with pod-template-hash, stable since 1.34, which restricts the count to the current ReplicaSet so a rolling update's old Pods do not distort the skew.

"What happens to spread constraints during a rolling update and a scale-down?"

During a rollout the constraint counts all Pods matching the selector, old and new, unless I use matchLabelKeys to scope it to the new ReplicaSet's hash. Without that, the old Pods occupy zones and the new Pods are forced into the gaps, which is usually fine but can leave the final layout uneven once the old Pods disappear. Scale-down is the bigger surprise: the ReplicaSet controller picks Pods to delete by its own rules, newest and least-ready first, and does not consult spread constraints at all, so after scaling from nine to three the survivors can all be in one zone. The scheduler never reruns for existing Pods. The only correction is the descheduler's RemovePodsViolatingTopologySpreadConstraint strategy on a schedule, or a PDB-aware rebalance during quiet hours.

"When does required anti-affinity beat spread constraints, and what does it cost at 2,000 Pods?"

It wins when the rule is genuinely "never share": two members of a quorum system, a primary and its standby, or two Pods that each bind the same host port. Those are pairwise facts, and anti-affinity says them exactly. The cost is scheduler time: for each candidate node the scheduler evaluates the anti-affinity terms against the existing Pods in that topology, and with a zone key on a 2,000-Pod cluster that means scanning a large fraction of Pods per node per scheduling attempt. The scheduler has precomputation and a per-Pod affinity cache, and it has been optimised over releases, but I have still seen scheduling latency climb to seconds when hundreds of Deployments each carried required anti-affinity with a broad selector. Keep the selector narrow, use hostname rather than zone where possible, and prefer preferred anti-affinity or spread constraints for everything that is a preference.

Q24 · Scenario. "Twelve Pods of a new Deployment have been Pending for 20 minutes. Nodes look half empty in the dashboard. Diagnose it."

Reveal answer

The real test Whether you go to the Pod's event message first and know that "half empty" means usage, not requests.

Strong answer I would diagnose in this order:

  1. Evidence first. kubectl describe pod on one Pending Pod and read the FailedScheduling event; it says exactly how many nodes each filter rejected: "0/40 nodes are available: 28 Insufficient memory, 8 node(s) had untolerated taint, 4 node(s) didn't match Pod's node affinity". That message is the diagnosis nine times out of ten.
  2. Likely causes, ranked. First, requests versus usage: the dashboard shows usage, but the scheduler sums requests, and a cluster at 40 percent usage can be 95 percent requested; kubectl describe node shows the allocated-resources table. Second, the new Deployment asks for something unusual — a large memory request, a GPU, a specific zone through a volume, a host port — that no node satisfies. Third, a required anti-affinity or spread constraint with DoNotSchedule that cannot be met by twelve replicas in three zones. Fourth, a taint on the pool the affinity points at, without a toleration. Fifth, the cluster autoscaler should have added nodes and did not: check its logs and status ConfigMap for "max size reached", a cloud quota error, or an instance type it cannot launch.
  3. Fix. Whichever the event names: lower requests to measured usage, add the toleration, relax the constraint to ScheduleAnyway, raise the node group maximum, or request the quota increase.
  4. Prevention. An alert on Pods Pending over five minutes; a rule that Deployments run kubectl apply --dry-run=server plus a scheduling simulation in CI for unusual requests; keep requested capacity below about 80 percent.

Land it The scheduler only ever sees requests and constraints, never usage — so a "half-empty" cluster with Pending Pods is a bookkeeping problem, and the Pod's own event tells you which line of the books.

Likely follow-ups
"The event says all nodes have insufficient memory, but adding requests per node does not reach allocatable. What is missing from your sum?"

Three things people forget to add. DaemonSet Pods, which sit on every node and are easy to leave out of a mental sum. Init containers: the scheduler uses the maximum of the largest init container request and the sum of the app containers, so a migration init container with a 3 GiB request raises the Pod's effective request. And Pod overhead from a RuntimeClass, for example gVisor or Kata, which adds a fixed amount per Pod. On the node side, terminating Pods still count until they are gone, so right after a rollout the old Pods hold their requests through the grace period. kubectl describe node shows the true Allocated resources table, and comparing that to the Pod's effective request usually finds the gap. If it still does not add up, the node may have been resized and the kubelet not restarted.

"The autoscaler should have added nodes. How do you read why it did not?"

The cluster autoscaler writes its reasoning to a ConfigMap named cluster-autoscaler-status in kube-system, which lists each node group with its current size, limits, and the last scale-up decision, and it emits events on Pending Pods such as NotTriggerScaleUp with the reason: no node group would fit the Pod, the maximum size is reached, or a quota error came back from the cloud. Its logs at verbosity 4 show the simulated scheduling per group. Common findings are a request larger than any single instance in the group, a taint on the group that the Pod does not tolerate so the simulator rejects it, and a topology constraint the simulator cannot satisfy with a new node in the wrong zone. Karpenter does the same through events on the Pod and its NodeClaim objects, which show provisioning failures verbatim.

"You freed capacity and the Pods are still Pending. What next?"

Then the scheduler is not retrying them, or they are failing a different filter now. The scheduler moves unschedulable Pods to a backoff queue and retries when relevant cluster events occur, such as a node being added or a Pod being deleted, and otherwise at a slower interval, so I first wait a minute and re-read the event, since the message updates with the new filter counts. If the message changed, I chase the new filter. If nothing changed, I check that the scheduler is alive through its lease, and I check for a scheduling gate or an unsatisfied PersistentVolumeClaim, because a Pod waiting on a volume that cannot be provisioned shows a different event, from the volume binding plugin. As a last resort I delete one Pending Pod so its controller creates a fresh one, which forces a clean scheduling cycle.

"How would you catch this before it hits production?"

With a capacity check in the deployment pipeline. kubectl apply --dry-run=server validates the object and admission but does not simulate scheduling, so I add a step that compares the Deployment's total effective request times replicas against the target pool's free allocatable, from kube-state-metrics, and fails if the pool cannot absorb the surge. For unusual requirements, GPUs, large memory, host ports, the check also confirms at least one node type in the pool satisfies them. Operationally, I keep requested capacity under about 80 percent with an alert, and I alert on any Pod Pending longer than five minutes, using kube_pod_status_phase with a for clause. Both alerts fire in staging first, where a new service's requests are usually first seen.

Q25. "How do PriorityClasses and preemption work, and what is the danger of giving your service a high priority?"

Reveal answer

Strong answer A PriorityClass is a cluster-scoped object mapping a name to an integer, and a Pod references one by name; the scheduler orders its queue by priority so high-priority Pods are placed first. Preemption is the second effect: if a high-priority Pod cannot be scheduled, the scheduler looks for a node where evicting some lower-priority Pods would make room, evicts them gracefully (respecting their termination grace period, and PDBs as a best effort but not a hard guarantee), and places the Pod. Two built-in classes, system-cluster-critical and system-node-critical, keep CoreDNS and the CNI alive under pressure. The kubelet also uses priority as a tiebreaker in node-pressure eviction. The danger is that priority is relative and global: if every team sets their service to "high", nothing is high, and the first team to set a higher number can evict everyone else's Pods on a full cluster — a scale-up of their Deployment becomes an outage for a neighbour. The sane setup is a small ladder defined by the platform team: critical platform components, then customer-facing services, then internal services, then batch, with preemptionPolicy: Never on the batch tier so it queues rather than evicts, and the default class in the middle.

Land it Priority is a zero-sum ranking across the whole cluster, so it must be a platform decision with a few rungs — not a knob every team turns to eleven.

Likely follow-ups
"What does the victim of preemption experience, and can a PDB stop it?"

The victim is deleted through a normal graceful termination: the preStop hook runs, SIGTERM is sent, and it has its terminationGracePeriodSeconds, so a service with a proper shutdown drains cleanly. Its controller recreates it, but on a full cluster the replacement may itself go Pending, which is the real harm. Since 1.31 the victim also gets the DisruptionTarget condition with reason PreemptionByScheduler, which Jobs can use to ignore the failure. A PDB is consulted but only as a preference: the scheduler tries to pick victims whose PDBs allow it and prefers nodes where no PDB is violated, but if the only way to place the high-priority Pod violates a PDB, it preempts anyway. That is the difference between preemption and the eviction API, and it is why a PDB is not a defence against a misconfigured priority ladder.

"What is the value of a Pod with no priorityClassName, and how would you set a cluster default?"

With no class the Pod's priority is zero, unless a PriorityClass has globalDefault true, in which case Pods without a class get that value. Only one class may be the global default. A useful ladder is something like platform-critical at 1000000, customer-facing at 10000, internal at 1000 as the global default, and batch at 100 with preemptionPolicy Never. The values are arbitrary integers below one billion; the two system classes sit above two billion and are reserved for kube-system. I enforce the ladder with a ValidatingAdmissionPolicy that rejects any PriorityClass creation outside the platform namespace, and a ResourceQuota with scopeSelector on PriorityClass so a team's namespace has a cap on how many high-priority Pods it may run, which is the built-in guard against everyone choosing the top rung.

"How would you find out that preemption is happening in production, and who is doing it?"

The scheduler emits an event of reason Preempted on the victim Pod naming the preemptor, and the metric scheduler_preemption_attempts_total counts attempts; scheduler_preemption_victims is a histogram of how many Pods were removed per attempt. kube-state-metrics gives kube_pod_info with priority_class, so I can chart Pods by class per namespace and spot a team that has moved everything to the top rung. In an incident I search events for Preempted in the affected namespace and read the preemptor's name, then its namespace's owner. On the prevention side, an alert on any preemption event in production namespaces is cheap, because on a healthy cluster with capacity headroom preemption should be rare enough that every occurrence is worth a look.

Q26 · Scenario. "A Pod has been scheduled — it has a node — but it has been in ContainerCreating for eight minutes. Walk me through it."

Reveal answer

Strong answer ContainerCreating means the scheduler is done and the kubelet is stuck before the process starts, so the causes are all on the node. In diagnosis order: kubectl describe pod and read the events from the kubelet. Ranked causes. One, image pull: ErrImagePull or ImagePullBackOff would show, with a reason — wrong tag, private registry without an imagePullSecret, registry rate limit, or a 4 GiB image on a slow link; check with crictl pull from a debug session on the node. Two, volumes: FailedMount or FailedAttachVolume — a ReadWriteOnce disk still attached to the old node after a hard node failure (a multi-minute detach timeout), a disk in a different zone than the node, a ConfigMap or Secret referenced by name that does not exist (that one is common and the event says it plainly). Three, networking: the CNI plugin failed to allocate an IP — a node that ran out of IPs in its range, which on the AWS VPC CNI means the subnet or the instance's ENI limit is exhausted; the event says "failed to create pod sandbox". Four, the container runtime itself unhealthy on that node — check kubectl get node conditions and the kubelet log. Fix follows the cause; prevention is pull-through registry caches, WaitForFirstConsumer on StorageClasses, IP capacity monitoring per node, and an alert on Pods in ContainerCreating for more than two minutes.

Land it Pending is a scheduler problem, ContainerCreating is a node problem — image, volume, or network, in that order of likelihood, and the kubelet's events name which.

Likely follow-ups
"The event says the volume is still attached to another node. How do you unblock it safely?"

First I check whether the old node still exists and whether the old Pod is genuinely gone, with kubectl get volumeattachment to see which node the attachment names, and kubectl get pods -A -o wide filtered to that node. If the old node is dead and gone from the cloud, the attach-detach controller will eventually force-detach after its six-minute timeout, so waiting is safe. If the old node exists but is NotReady, the old Pod may be Terminating and still holding the mount; force-deleting that Pod lets the controller detach. If I must move faster, deleting the VolumeAttachment object triggers a detach, but only after confirming the disk is not mounted anywhere, since forcing a detach from a live writer corrupts data. For cloud disks I confirm the state in the cloud console before any forcing.

"How does the CNI fail, and what is the fix at 10 times the Pod density?"

The kubelet's event reads "failed to create pod sandbox" followed by the plugin's error. With the AWS VPC CNI the common one is no free IPs: each instance type has a fixed number of network interfaces and addresses per interface, so an m5.large gets about 29 Pod IPs and a subnet can simply run out. At ten times the density I need prefix delegation, which assigns a /28 prefix per interface slot and raises the limit to over a hundred Pods per node, larger subnets or secondary CIDRs, and a warm pool setting such as WARM_PREFIX_TARGET so a burst does not wait for the cloud API. On GKE the equivalent is the Pod CIDR range per node, and on overlay CNIs such as Cilium or Calico the per-node block size. In every case the metric to watch is available IPs per node, and to alert before it hits zero.

"Image pulls are the cause. What are the fastest wins, in order?"

First, a pull-through cache or a registry in the same region and network, because a cross-region or Docker Hub pull is slow and rate-limited. Second, image size: a Spring Boot image on a distroless base with layered JARs is 250 MiB rather than a gigabyte, and layering means only the application layer changes between builds so the rest is cached on the node. Third, imagePullPolicy IfNotPresent with digest-pinned tags, so a node that already has the image does not re-pull. Fourth, pre-pulling with a DaemonSet that references the image, useful before a large rollout. Fifth, the kubelet's --serialize-image-pulls false so several images pull in parallel, and --image-pull-progress-deadline for stuck pulls. Since 1.33, the kubelet can also be configured to verify pull credentials per image, which matters for the private-registry case.

"How would you get onto the node to look, on a managed cluster where you have no SSH?"

With kubectl debug node/worker-7 -it --image=busybox, which creates a privileged Pod on that node with the host's filesystem mounted at /host and the host namespaces shared. From there I can read the kubelet log with chroot /host journalctl -u kubelet, run crictl ps and crictl pull to test the runtime and the registry, and inspect the CNI's IP allocation files under /host/var/lib/cni. The Pod is created directly with nodeName set, so it bypasses the scheduler and works on a node that is cordoned. Cloud consoles offer the same through a session manager. I would restrict this capability with RBAC, because it is root on the node, and record its use through the audit log.

Q27. "A node has 16 CPUs and 64 GiB. Why can the scheduler not place 16 CPUs of Pods on it? Explain capacity, allocatable, and reserved resources."

Reveal answer

Strong answer kubectl describe node shows two blocks: Capacity, the hardware, and Allocatable, what the scheduler may hand to Pods. The difference is what the kubelet is configured to hold back: kube-reserved for the kubelet, containerd, and kube-proxy; system-reserved for the operating system daemons; and the eviction threshold, the memory the kubelet keeps as a buffer before it starts evicting, 100 MiB by default and often set higher. Managed services apply their own formula — GKE, for example, reserves a sliding percentage of memory that is larger on small nodes — so a 64 GiB node may show around 58 GiB allocatable and 15.9 CPUs. The scheduler sums Pod requests against allocatable, never capacity. Two things follow. Many small nodes waste more than a few large ones, because the reservation is per node. And DaemonSet Pods consume allocatable too, so with a mesh agent, a log shipper, a metrics agent, and a CNI Pod on every node — say one CPU and 2 GiB in total — a 4-CPU node has only about 3 CPUs left for real work, which is why sizing node pools has to start from the per-node overhead rather than from the instance catalogue.

Land it Allocatable is capacity minus the node's own needs, and the per-node overhead is the argument for fewer, larger nodes.

Likely follow-ups
"How would you decide the right instance size for a JVM fleet, with numbers?"

Start from the per-node overhead. Say the DaemonSets and reservations take 1 CPU and 2.5 GiB regardless of node size. On a 4-CPU, 16 GiB node that is 25 percent of CPU and about 16 percent of memory lost; on a 16-CPU, 64 GiB node it is 6 and 4 percent. Then apply the blast-radius rule: no node should hold more than about 10 percent of any one service, so a service with 10 replicas needs at least 10 nodes of whatever size, and a node loss costs one replica. For a fleet of Spring Boot services requesting 500m CPU and 1.5 GiB each, a 16-CPU, 64 GiB node holds about 30 such Pods by memory and 30 by CPU, which is a good balance. I usually land on 8 to 16 vCPU memory-optimised instances, and I keep a pool of at least six nodes per zone so a single node's loss is absorbed.

"Which kubelet flags set reserved resources, and what happens if you set them too low?"

The kubelet configuration fields are kubeReserved and systemReserved, each a map of cpu, memory, and ephemeral-storage, plus evictionHard for the thresholds such as memory.available 100Mi. Allocatable equals capacity minus the two reservations minus the hard eviction threshold. Setting them too low means the scheduler can pack Pods so tightly that the kubelet, containerd, and the operating system are starved when the Pods use their requests. On memory that shows as the kernel OOM-killing containerd or the kubelet itself, and the node goes NotReady while every Pod on it keeps running unsupervised. On CPU it shows as a node with a high load average whose kubelet misses heartbeats. Managed providers set these for you; on self-managed nodes I use the GKE formula as a starting point and also set enforceNodeAllocatable to include pods so the cgroup limit is real.

"Does ephemeral storage work the same way, and what evicts a Pod for disk?"

Yes, with the same three-way split. Capacity is the root filesystem, allocatable subtracts the reservations, and the kubelet monitors nodefs and imagefs. The eviction signals are nodefs.available and imagefs.available, with defaults of 10 percent and 15 percent free. When crossed, the kubelet first reclaims by deleting dead containers and unused images, then evicts Pods, ranking by ephemeral-storage usage over request. A Pod whose containers write logs to the container's writable layer, or fill an emptyDir, is charged that usage, and a Pod that exceeds its ephemeral-storage limit is evicted regardless of node pressure. The common surprise is that container logs count, so a chatty application with no log rotation evicts itself, and the fix is stdout logging with the kubelet's containerLogMaxSize, which is 10 MiB by default.

Q28 · Design. "Design the node pools for a cluster running Spring Boot services, a nightly batch job, and a small GPU inference service — and explain how you keep each from interfering with the others."

Reveal answer

Strong answer Requirements: latency-sensitive JVM services need steady CPU and multi-zone availability; batch needs cheap, large bursts and can tolerate interruption; GPU inference needs expensive hardware that nothing else should occupy. Design: a general pool of memory-optimised instances (JVMs are memory-heavy relative to CPU), spread across three zones, on-demand, sized so that no single node holds more than about 10 percent of any service, autoscaled between a floor that survives a zone loss and a ceiling; the services carry topology spread constraints across zones and nodes. A batch pool of compute-optimised spot instances, tainted workload=batch:NoExecute, scaling from zero via Karpenter, with the batch Job tolerating the taint and using node affinity to require it; a low PriorityClass with preemptionPolicy: Never. A GPU pool tainted nvidia.com/gpu:NoSchedule — the device plugin adds the taint — with the inference Deployment requesting nvidia.com/gpu: 1, which is a resource the scheduler counts like CPU, so only one Pod per GPU. A separate small system pool, on-demand, for CoreDNS, the metrics stack, and controllers, so a batch spike cannot evict cluster plumbing. Trade-offs: more pools mean more per-node overhead and less bin-packing, so I would not create a pool per team; taints keep others out, but I also need ResourceQuotas so the batch team cannot starve the general pool by simply not tolerating its taint. What I would not do: mix spot into the general pool for stateless services unless every service has a PDB and a tested graceful shutdown — spot is a two-minute warning, and most JVM services have never been tested against it.

Land it Pools are separated by taint and priced by tolerance for interruption — and the pool that hosts the cluster's own plumbing is the one you never let anything else near.

Likely follow-ups
"The GPU service grows from one small model to four models that each need part of a GPU. What changes?"

The scheduler counts nvidia.com/gpu as an integer, so four Pods each requesting one GPU need four GPUs even if each uses a quarter. To share, I have three options as of Aug 2026. Time-slicing through the NVIDIA device plugin's configuration, which advertises each GPU as several resources and lets Pods share it with no memory isolation, good for low-traffic inference. Multi-Instance GPU on A100 and H100 class cards, which partitions the hardware into isolated slices advertised as nvidia.com/mig-1g.10gb and similar, giving real isolation. Or dynamic resource allocation, stable since 1.34, where a ResourceClaim describes the device and the driver allocates a share, which is the direction the ecosystem is moving. I would pick MIG for isolation between models and time-slicing for cost, and put the model server behind one Deployment per model so each scales on its own.

"What would you cut with one week and one engineer?"

I would collapse to two pools: a general on-demand pool and a single tainted "special" pool that holds both batch and GPU nodes as separate node groups behind one taint, with priority and quotas doing the isolation between batch and inference. I would drop the separate system pool and instead give the platform components system-cluster-critical priority and Guaranteed QoS on the general pool, which protects them adequately on a moderately loaded cluster. Spot for batch I would defer, because testing graceful interruption takes time, and run batch on on-demand with a scale-to-zero group. What I would not cut is the taint on the GPU nodes, because a GPU node accidentally filled with Spring Boot Pods is the most expensive mistake in the design, and the zone spread for the general pool.

"Spot nodes for the batch pool: how does an interruption actually reach the Pod?"

The cloud gives about two minutes of notice through instance metadata. On AWS with Karpenter, or with the Node Termination Handler on older setups, an agent watches that signal, cordons the node so nothing new lands, and drains it, which evicts Pods through the eviction API with their normal grace period, capped by the two minutes. The Job Pod receives SIGTERM, finishes or abandons its current item, and exits; the DisruptionTarget condition lets the Job ignore the failure and start a replacement. What I have to verify is that the terminationGracePeriodSeconds plus the drain's own overhead fit inside two minutes, that the queue's visibility timeout returns the abandoned item, and that the cluster has on-demand fallback capacity, since a spot pool can be reclaimed wholesale in one availability zone at once.

"How do you stop a batch team from starving the general pool by just not tolerating the batch taint?"

A taint only keeps Pods out of the batch pool; nothing stops the batch team from omitting the toleration and landing on the general pool. The guards are on their namespace. A ResourceQuota caps total requests, so at most their quota's worth of general capacity can be consumed, and a quota with scopeSelector on PriorityClass can cap how much they may run at the customer-facing priority. A ValidatingAdmissionPolicy in CEL on the batch namespace can require that every Pod carry the batch toleration and node affinity, so the platform chart's values are not optional. And LimitRange maximums stop a single 60 GiB Pod. With those, the batch team can still run on the general pool by accident, but only within a bounded slice and at low priority, so preemption clears them if the online services need the space.

Q29. "What happens if you set spec.nodeName on a Pod directly? And what are scheduling gates for?"

Reveal answer

Strong answer Setting nodeName bypasses the scheduler entirely: the kubelet on that node sees a Pod bound to it and tries to run it, with no filtering. That means no check of resources, taints, or affinity — the kubelet will admit it only if the node has room at that instant, and otherwise the Pod fails with OutOfcpu or OutOfmemory rather than waiting. It is how static Pods and some tests work; in production it is almost always a mistake, and the right tool is a required node affinity on kubernetes.io/hostname, which goes through the scheduler. Scheduling gates, stable since 1.30, are the opposite: a list of named gates in spec.schedulingGates that keep a Pod out of the scheduler's queue until every gate is removed by whoever owns it. They exist so that an external controller — a queue-based batch system like Kueue, a quota manager, a system that must reserve capacity first — can create Pods and hold them back until it decides they may run, without hacks like unsatisfiable affinities. When the controller removes the last gate, the Pod becomes an ordinary Pending Pod and is scheduled normally.

Land it nodeName skips the scheduler and gates pause it — one throws away the safety checks, the other lets you add your own before them.

Likely follow-ups
"Walk through what Kueue does with scheduling gates, concretely."

Kueue is a job queueing system built on gates. A team submits a Job with a queue-name label; Kueue's webhook adds a scheduling gate to the Job's Pods, or suspends the Job, so nothing is scheduled. Kueue then admits workloads against ClusterQueue quotas, for example a research queue with 200 CPUs and 4 GPUs, in a fair or priority order. When it admits a workload it removes the gate, and optionally injects node affinity for the flavour it chose, such as spot or on-demand, and the Pods become ordinary Pending Pods. If the cluster is full, Pods wait in Kueue's queue rather than as thousands of Pending Pods spamming the scheduler with failed attempts. That is the point: scheduling gates move the "should this run yet" decision out of the scheduler's hot loop into a controller that understands quotas across the whole cluster.

"What are the failure modes of a scheduling gate?"

A gate is a promise by an external controller to remove it, so the failure is the controller not doing so. If the controller is down or its webhook is misconfigured, Pods sit Pending forever with the SchedulingGated reason, which kubectl get pods shows in the status column, and no scheduler event appears because the scheduler never saw them. Gates can only be removed, never added, after creation, so a controller cannot re-gate a Pod. And a Pod that is gated cannot have its nodeAffinity tightened arbitrarily; since the gate's purpose includes letting the controller inject affinity, the API allows adding affinity terms while gated, but not removing them. Operationally I alert on Pods with the SchedulingGated reason for more than a few minutes, distinct from the ordinary Pending alert, because the remedy is different.

"When is setting nodeName directly actually correct?"

In three narrow cases. Static Pods, which the kubelet creates from its manifest directory for the control plane itself on kubeadm clusters, have an implicit nodeName and never touch the scheduler by design. Debug Pods created by kubectl debug node, which must land on a specific node even if it is cordoned or has no free allocatable. And tests that exercise the kubelet directly. In an operator, if I must place a Pod on a specific node, for example a local-storage database whose disk is on that machine, I still go through the scheduler with a required nodeAffinity on kubernetes.io/hostname, because then resource accounting, taints, and quotas apply, and the failure mode is a Pending Pod with an event rather than a Pod that runs and starves its neighbours.

Q30 · Scenario. "After a scale-up, six new Pods of the same service all landed on the two nodes the autoscaler just added, while older nodes sit at 30 percent. Now those two nodes are hot. Why, and what do you do?"

Reveal answer

Strong answer In diagnosis order: the symptom is placement clustering on fresh nodes, which is the scheduler doing exactly what it scores. Evidence: kubectl get pods -o wide confirms the distribution; describe node on the old nodes shows their requested resources are high even though usage is 30 percent — they were full by the scheduler's arithmetic, which is why the autoscaler added nodes in the first place; the new nodes were the only ones with room, so all six went there. The second contributor is that the default scoring prefers the least-allocated node, which the empty new node wins every time, and the service has no spread constraint across hostnames, only across zones. The hot-node problem is then that those six JVMs start simultaneously, all compiling and warming up on the same two machines. Fixes, short term: nothing dramatic — as usage settles the nodes are fine; if they are not, a descheduler run with the RemoveDuplicates or LowNodeUtilization strategy evicts some Pods so they reschedule elsewhere. Long term: add a topology spread constraint on kubernetes.io/hostname with maxSkew: 1 and ScheduleAnyway so replicas prefer to spread across nodes; right-size the old Pods' requests so the old nodes are not falsely full; and stagger scale-ups with the HPA's scale-up policy so six Pods do not arrive in one burst. Prevention: requests that track usage, and a spread constraint in the platform's base chart so every service gets it.

Land it The scheduler packed the only nodes that had room by its bookkeeping — fix the bookkeeping and the spread rule, and the hot nodes go away on their own.

Likely follow-ups
"You added the hostname spread constraint and the next scale-up still packed. Why?"

With ScheduleAnyway, the constraint is a scoring preference, and the scoring is a weighted sum with other plugins. The NodeResourcesFit LeastAllocated score strongly favours the empty new nodes, and the spread score's weight of 2 on the default profile can lose. Also, if the old nodes really are full by requests, the filter phase already removed them and no score can bring them back, which is the first thing to recheck. Two fixes: use DoNotSchedule for the hostname constraint with maxSkew 1, accepting that a scale-up may wait for the autoscaler, or raise the PodTopologySpread plugin's weight in a scheduler profile if I control it. And the root cause remains the old nodes' inflated requests; until those are right-sized, the scheduler correctly sees no room there.

"Is running the descheduler in production safe? What would you configure?"

It is safe if it is constrained, because it evicts through the eviction API and therefore honours PodDisruptionBudgets, and it never touches Pods without a controller, DaemonSet Pods, or Pods with local storage unless told to. I would run it as a CronJob, not continuously, with the LowNodeUtilization plugin set to thresholds like 20 percent low and 70 percent high, so it only moves Pods from nodes above 70 to nodes below 20, and RemovePodsViolatingTopologySpreadConstraint. I would set maxNoOfPodsToEvictPerNode and per namespace to small numbers so a run is a gentle nudge, exclude namespaces with stateful workloads, and require that every candidate service has a PDB, since a service with a single replica and no budget would be evicted and briefly gone. Then I watch error rates during the first few runs before trusting it unattended.

"How would you stagger the arrival of six new JVMs so they do not warm up on the same node at once?"

On the HPA, a scaleUp policy of, say, two Pods per 30 seconds spreads the burst, at the cost of slower reaction, which is a trade I accept if the trigger is early. On the Deployment side there is no per-Pod stagger, but a startup probe with readiness gated on warm-up keeps cold Pods out of traffic so they at least do not receive requests while compiling. On the node side, the fix is to make the warm-up cheaper: class data sharing, Spring AOT, or a smaller ActiveProcessorCount during startup so a single JVM cannot saturate the node's cores. And I would spread by design, with the hostname constraint, so that even a simultaneous burst lands on six nodes and each pays one warm-up rather than six.

Drill · API machinery, extension & access

This group tests the parts under the objects: versions, concurrency, custom resources, finalizers, and how humans and pipelines are let in.

Q31. "Two controllers update the same object at the same time. How does Kubernetes stop one from silently overwriting the other?"

Reveal answer

Strong answer Every object carries a metadata.resourceVersion, an opaque string from etcd's revision counter that changes on every write. An update (a PUT of the whole object) must include the resourceVersion the client read; if the object has changed since, the API server rejects the write with a 409 Conflict, and the client must re-read and retry. That is optimistic concurrency — the same idea as a version column in JPA (see E5), with the same retry loop on the client; client-go has RetryOnConflict for it. A patch is different: a strategic-merge or JSON-merge patch is applied server-side to the current object with no version check, so two patches to different fields both succeed — which is why controllers prefer patching status over updating the whole object. Server-side apply adds a third mode with field ownership, where conflicts are about managers rather than versions. The trap is a read-modify-write with a stale copy that ignores the 409 and retries with the old body, which really does overwrite; the correct loop always re-reads.

Land it resourceVersion is the optimistic lock — updates need it and fail loudly, patches skip it and merge — and a controller that does not re-read on conflict will eventually clobber someone.

Likely follow-ups
"Show me the retry loop you would write in Java or Go for an update that can conflict."

In Go with client-go it is retry.RetryOnConflict with retry.DefaultRetry, whose body re-reads the object with Get, applies the change to the fresh copy, and calls Update; if Update returns a 409, the helper waits with jittered back-off, five attempts by default, and calls the body again, which re-reads. With the Java fabric8 client the equivalent is the edit method with a lambda, which re-fetches and retries on conflict internally, or a loop around get and replace that catches KubernetesClientException with code 409. The essential property in either language is that the read happens inside the retried block, so every attempt starts from the latest resourceVersion. A loop that reads once and retries the same body is the bug the question is about, and it passes tests because conflicts are rare on a laptop.

"When would you prefer an update over a patch, if patches skip the version check?"

When the correctness of my write depends on what I read. Incrementing a counter in an annotation, removing one item from a list of finalizers, or deciding to scale based on the current replica count all need to know that nothing changed in between, and a full update with resourceVersion gives exactly that guarantee. A JSON merge patch that sets a field to an absolute value is safe without it, but a patch that sets a field to a value computed from the old object is a lost-update bug waiting to happen. A middle ground is a JSON patch with a test operation, which asserts a field's current value before applying and fails if it differs; and a patch can carry resourceVersion in its body, in which case the server does enforce the check, which few people know.

"What is a resourceVersion actually, and can you compare two of them?"

It is etcd's global revision number at the moment the object was last written, serialised as a string, and every write to any object in the cluster increments the global counter, so two consecutive versions of one object can differ by thousands. The API convention says clients must treat it as opaque: equality is meaningful, ordering is not guaranteed by contract, even though on etcd-backed clusters it is numerically increasing. So I never sort by it or compute deltas from it. Where it is used beyond conflicts is in watches, as the point to resume from, and in list calls with resourceVersionMatch to ask for a result at least as fresh as a given version. In controllers, comparing generation, which increments only on spec changes, is the right way to detect that a user changed something.

Q32. "What is a CustomResourceDefinition, how is validation done, and how do you evolve one from v1alpha1 to v1 without breaking existing objects?"

Reveal answer

Strong answer A CRD registers a new resource type with the API server — a new kind, group, and version — after which the API server stores, lists, and watches objects of that kind exactly like built-in ones, with no code of mine running in the API server. Validation is an OpenAPI v3 schema embedded in the CRD, which rejects unknown fields and wrong types, and since 1.29 CEL validation rules stable in the schema, so I can say "replicas must be at most maxReplicas" without a webhook. Evolution: a CRD lists several versions with exactly one marked as the storage version; objects are stored in that version and served in any listed version. When the shape changes between versions, I register a conversion webhook that translates objects on the fly, or use strategy: None if only the version string differs. The migration: add v1 alongside v1alpha1 with conversion, switch the storage version to v1, run a storage migration (a no-op update of every object, or the storage-version-migrator) so everything on disk is v1, then mark v1alpha1 as not served, and finally remove it. The two ways to break people: removing a served version while their manifests still use it, and changing the storage version without migrating, which leaves objects that can no longer be decoded.

Land it A CRD makes the API server your database with schema validation for free — and versioning it is a real API migration with a conversion layer, not a rename.

Likely follow-ups
"What does a conversion webhook look like, and what happens if it is down?"

It is an HTTPS endpoint, registered in the CRD's spec.conversion with strategy Webhook, that receives a ConversionReview containing a list of objects and a desired API version and returns the converted objects. The API server calls it whenever an object's stored version differs from the version a client requested, so it sits on the read path as well as the write path. That is the danger: if the webhook is down, every get, list, and watch of that resource in a non-storage version fails, controllers that use the old version stall, and if the storage version itself is the one nobody can reach, deletes can fail. So I run it with two replicas and a PDB, keep it in the same Pod as the operator only if the operator is equally available, and I move the storage version and all clients to v1 quickly so the webhook stops being on the hot path.

"How do you run the storage migration, and how do you verify it finished?"

The migration is a rewrite of every object so that etcd holds it in the new storage version. The simplest way is a no-op update of each object, for example kubectl get and kubectl replace in a loop, or the kube-storage-version-migrator controller which does it as a StorageVersionMigration resource. Verification is on the CRD's status.storedVersions list: as long as v1alpha1 appears there, some object may still be stored in it, and the API server will refuse to let me drop v1alpha1 from the served list. After the migration I patch status.storedVersions to contain only v1, which is allowed once no object remains in the old version, and then removing v1alpha1 from the versions list succeeds. If the patch is rejected, the migration is incomplete and I look for objects the loop missed, usually in namespaces it had no rights to.

"A CEL validation rule is too strict and now existing objects fail validation. What happens to them?"

Existing objects are not re-validated in storage, so nothing breaks immediately. The problem appears on the next write: any update to a non-compliant object, including a status update from my own controller, fails validation, so the controller cannot record progress and the object is effectively frozen. Kubernetes has ratcheting validation, stable since 1.30, which helps here: if a field's value is unchanged from the stored value, a failing rule on that field is tolerated, so an update that touches only other fields succeeds. Rules that inspect the whole object or use transition rules with oldSelf do not ratchet. The safe process is to add a new rule with messageExpression first, audit existing objects against it with a script, fix them, and only then tighten. I test schema changes in a kind cluster against a dump of production objects.

"Why use a CRD rather than storing this state in the operator's own database?"

A CRD gives me a typed, versioned, validated, RBAC-controlled, audited, watchable store with kubectl support, all without running a database, and my consumers can react to changes with the same watch mechanism the rest of the cluster uses. The cost is that the API server is not a general database: objects are capped at about 1.5 MiB, there are no queries beyond label and field selectors, there is no transaction across objects, and high-churn writes bloat etcd. So the rule is that a CRD holds desired state and a compact status for things that live at the cadence of infrastructure changes. Anything that changes every second, is large, or needs joins, such as a list of ten thousand processed invoices, belongs in a real database, with the CRD holding only a reference to it.

Q33. "What is a finalizer, and how does deletion actually proceed when one is present?"

Reveal answer

Strong answer A finalizer is a string in metadata.finalizers that says "do not remove this object from storage until I have been cleared". When a client deletes an object that has finalizers, the API server does not remove it; it sets metadata.deletionTimestamp and leaves the object in place, which is the Terminating state you see. Each controller that owns a finalizer watches for that timestamp, performs its cleanup — releasing a cloud load balancer, detaching a disk, deleting the database schema an operator created — and then patches the object to remove its finalizer. When the list is empty, the API server deletes the object for real. Built-in examples: kubernetes.io/pv-protection keeps a PersistentVolume alive while a claim uses it, and the foreground-deletion finalizer holds an owner until its dependents are gone. The design rule for my own operators: add the finalizer on first reconcile, make the cleanup idempotent and tolerant of the external system already being gone, and never leave a finalizer whose controller has been uninstalled — that is the classic stuck-Terminating object, which only a manual patch removing the finalizer can free, at the price of skipping the cleanup it was guarding.

Land it A finalizer is a veto on deletion held by whoever must clean up — powerful, and exactly why an uninstalled operator leaves objects that cannot die.

Likely follow-ups
"What exactly do you do in the reconcile function when deletionTimestamp is set?"

The reconcile first checks whether metadata.deletionTimestamp is non-zero. If it is, and my finalizer is present, I run the cleanup: call the external system to delete what I created, treating a not-found response as success so the cleanup is idempotent. If the cleanup fails with a transient error I return the error, so the work queue retries with back-off, and I set a status condition saying deletion is blocked and why. When cleanup succeeds I remove my finalizer from the list with a patch, not a full update, so I do not conflict with other finalizer owners, and return without requeueing; the API server removes the object once the list is empty. If deletionTimestamp is not set and my finalizer is missing, I add it before doing any provisioning, so there is never a window where I have created something the cleanup does not know about.

"The operator is uninstalled and 300 objects are stuck. How do you clear them without losing track of the external resources?"

I do not start with the finalizer patch. I export the objects first, kubectl get -A -o yaml into a file, because once I remove the finalizers the objects are gone and with them the only record of what was provisioned. Then I reinstall the operator, even the old version, briefly: its reconcile sees the deletionTimestamps, runs cleanup, removes finalizers, and the objects disappear properly. If reinstalling is impossible, I run the cleanup myself from the exported list with a script against the external system, and only then remove finalizers in bulk with a kubectl patch loop setting metadata.finalizers to an empty list. I record the orphan check in the incident notes, because an operator that was uninstalled without cleanup usually also has leftover credentials and cloud resources billing quietly.

"Can a finalizer block a namespace deletion, and what does the namespace controller do about it?"

Yes, and that is the most common stuck-namespace cause. The namespace controller deletes every resource in the namespace and waits for all of them to be gone; an object whose finalizer is never removed stays Terminating, so the namespace stays Terminating with the NamespaceContentRemaining condition naming the kind. The controller does not remove finalizers itself, because that would skip cleanup logic it knows nothing about. The namespace's own finalizer, the string kubernetes in spec.finalizers, is a separate mechanism that the namespace controller removes when it has confirmed the contents are gone; forcing it off through the finalize subresource is how people make namespaces vanish, leaving contents orphaned in etcd. So the design rule for my operators is to handle the case where the namespace is deleting and my external dependencies inside it are already gone.

Q34 · Scenario. "A namespace has been stuck in Terminating for three days. Nothing is in it as far as anyone can tell. Diagnose and fix it properly."

Reveal answer

Strong answer Diagnosis order: a namespace terminates only when every resource inside it — of every kind, including custom resources — is gone. Evidence: kubectl get namespace shop -o yaml and read status.conditions; it lists exactly what is blocking, typically NamespaceContentRemaining with the resource kinds left, or NamespaceDeletionDiscoveryFailure naming an API group the server could not reach. Likely causes, ranked. One: custom resources with finalizers whose operator has been uninstalled — kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -n shop finds them. Two: an aggregated API service (a metrics adapter, an old metrics.k8s.io registration) that is down, so the namespace controller cannot even enumerate that group and refuses to finish — kubectl get apiservice shows one as False. Three: a Pod stuck Terminating on a dead node. The fix is to remove the cause, not the symptom: reinstall the operator briefly so its finalizer logic runs, delete the stale APIService, or force-delete the Pod. Only if the operator is gone for good do I patch the finalizers off the leftover custom resources, knowing that skips whatever cleanup they guarded — a cloud resource may be orphaned and must be checked. What I would not do first is the widely copied trick of removing the kubernetes finalizer from the namespace itself via the finalize endpoint; it makes the namespace disappear while leaving its contents dangling in etcd.

Land it The namespace's status conditions name the blocker — fix the blocker, and reach for the finalizer patch only after accepting that its cleanup will never happen.

Likely follow-ups
"You deleted the stale APIService and it is still stuck. What now?"

Then discovery was not the only blocker, or the namespace controller has not retried yet. I re-read status.conditions on the namespace, because they update within a minute; if NamespaceDeletionDiscoveryFailure has cleared but NamespaceContentRemaining now lists kinds, I move on to those. The enumeration command has to cover every namespaced resource type including custom ones, so I run kubectl api-resources --verbs=list --namespaced -o name piped to kubectl get with --ignore-not-found and --show-kind, and look for anything with a deletionTimestamp. A Pod on a dead node needs a force delete; a custom resource needs its operator or a finalizer patch; a PersistentVolumeClaim with pvc-protection needs the Pod that uses it gone. If truly nothing is listed, I check that the namespace controller in the controller manager is running, since a leaderless controller manager stalls every namespace deletion silently.

"What is the actual command to run the finalizer patch on the namespace, and why is it dangerous?"

The trick is kubectl get namespace shop -o json, edit spec.finalizers to an empty list, and send it to the finalize subresource with kubectl replace --raw /api/v1/namespaces/shop/finalize -f the file. The namespace disappears within seconds. The danger is that the namespace object was the only thing holding those contents in a consistent state. Anything still stored under that namespace, custom resources with finalizers especially, remains in etcd with no namespace, invisible to most listings but still there; if a namespace with the same name is created later, those ghost objects reappear inside it, sometimes with an operator that suddenly finds objects it never created. I have seen exactly this cause a cloud resource to be deleted a year later. It is a last resort after the contents are confirmed gone by direct etcd inspection.

"How would you prevent stuck namespaces as a platform standard?"

Three rules. Every operator installation is paired with an uninstall procedure that deletes its custom resources first and waits for them, and the Helm chart or Argo application enforces that ordering with a pre-delete hook or sync waves. Aggregated APIServices are monitored: an alert on any APIService with Available False for more than ten minutes, because a dead one blocks every namespace deletion and every discovery call. And a periodic job that lists namespaces in Terminating for more than one hour and pages the platform team with the conditions attached, so the problem is diagnosed while the operator that caused it is still installed. I also test namespace deletion in the environment teardown of every ephemeral preview environment, which surfaces a leaky operator on the first day rather than months later.

Q35. "How should humans authenticate to a production cluster, and why are client certificates the wrong answer for people?"

Reveal answer

Strong answer The API server supports several authenticators: X.509 client certificates, static tokens, ServiceAccount tokens, and OpenID Connect (OIDC), where a kubectl plugin obtains a short-lived identity token from the company's identity provider — Okta, Entra ID, Google — and the API server verifies it and reads the user's group claims. For managed clusters the cloud's IAM plays the same role: aws eks get-token or gke-gcloud-auth-plugin exchanges cloud credentials for a token. Client certificates are wrong for people for three reasons. Kubernetes has no certificate revocation: a leaked certificate is valid until it expires, which is often a year. Certificates carry no group membership from the directory, so RBAC must bind individual users, and offboarding becomes a hunt. And they are files on laptops that get copied. With OIDC, access is a group in the identity provider, tokens last an hour, disabling the user in the directory disables cluster access within the hour, and the audit log shows a real identity. Certificates remain right for machine-to-machine within the control plane (kubelet to API server), where rotation is automated.

Land it Humans get in through the identity provider with group claims, and RBAC binds groups, not people — because revocation and offboarding are the whole problem.

Likely follow-ups
"What are the API server flags for OIDC, and how do group claims reach RBAC?"

The classic flags are --oidc-issuer-url pointing at the identity provider, --oidc-client-id, --oidc-username-claim, usually email, and --oidc-groups-claim, usually groups, plus optional prefixes such as --oidc-groups-prefix oidc: so that provider groups cannot collide with system groups. Since 1.30 the structured alternative is --authentication-config with an AuthenticationConfiguration file, which supports several issuers and CEL expressions for claim mapping and validation. The API server verifies the token's signature against the issuer's published keys, checks expiry and audience, and then constructs a user info with the name and groups from the claims. RBAC bindings name a Group subject such as oidc:team-payments, and that is the whole link: change group membership in the directory, and the next token carries the new groups.

"How does the kubectl side get and refresh the token without the user logging in every hour?"

The kubeconfig uses an exec credential plugin: a users entry with exec pointing at a binary such as kubelogin or the cloud CLI, which kubectl runs before each request. The plugin caches the ID token and a refresh token on disk, returns the ID token while it is valid, and uses the refresh token to get a new one silently when it expires, so the browser login happens once a day or once a week depending on the provider's refresh token lifetime. Managed clusters do the same with aws eks get-token, which signs a request with the user's cloud credentials and lasts 15 minutes, and gke-gcloud-auth-plugin. The cached refresh token is the sensitive file now, but it is revocable at the provider, unlike a certificate, and disabling the user in the directory invalidates it.

"A leaked kubeconfig with a client certificate: what can you actually do?"

Very little on the certificate itself, since the API server has no revocation list. The options are all blunt. Remove every RoleBinding and ClusterRoleBinding that names the certificate's common name or its organisation groups, which is workable only if bindings were per-user, and is why people used a shared group in the O field. Rotate the cluster's client CA, which invalidates every certificate including the kubelets', a serious operation. Or, for a single identity, use a webhook authoriser or an authentication webhook with a denylist, which most clusters do not have. In practice the answer is to treat the cluster as compromised for that identity's scope and rotate the CA if the identity was privileged. That is the story I tell when someone proposes certificates for humans.

"How should CI pipelines authenticate, since they are not humans either?"

With short-lived, identity-bound tokens, never a stored kubeconfig. The pattern is workload identity federation: the CI system, such as GitHub Actions or GitLab, issues an OIDC token for the running job that names the repository and branch; the API server, or the cloud's IAM in front of it, trusts that issuer and maps the claims to a Kubernetes group, so main-branch jobs from the payments repository map to a deployer role in the payments namespace and nothing else. The token lives minutes. Even better is to have the pipeline write to Git only and let the in-cluster GitOps agent, which uses a ServiceAccount that never leaves the cluster, do the applying; then the pipeline needs no cluster credentials at all, which is the design I push for in production.

Q36 · Design. "Design cluster access for 150 engineers across 12 teams, three environments, with an audit requirement and a rule that nobody has standing admin in production."

Reveal answer

Strong answer Requirements: least privilege by default, self-service within a team's own space, an audit trail, and emergency access that is possible but visible. Design: authentication through OIDC with groups synchronised from the directory — team-payments, platform, sre-oncall. Each team owns one namespace per environment. RBAC: a ClusterRole team-developer with read on everything in a namespace plus exec and port-forward, bound per team namespace in dev and staging; in production the same group gets read-only, because changes go through GitOps and the Argo CD or Flux agent is the only identity that writes Deployments. A platform-admin ClusterRole bound to the platform group cluster-wide in non-production only. Production admin is break-glass: a group nobody is in by default, joined through a just-in-time approval workflow in the identity provider that expires after two hours and pages a channel when used. Secrets: get secrets is excluded from the developer role everywhere; developers read them through the external store's UI with its own audit. Enforcement: API server audit logging at the request-metadata level shipped to a SIEM, Pod Security Admission at restricted, and an admission policy denying RoleBindings to cluster-admin outside a break-glass label. Trade-off: developers lose the ability to hot-patch production, which is the point, but on-call must have a fast, tested path through GitOps plus break-glass. What I would not do: per-user RoleBindings, shared kubeconfigs, or a "temporary" cluster-admin binding for the migration.

Land it Groups from the directory, namespaces per team, write access only for the GitOps agent in production, and admin as a time-boxed alarm — access design is offboarding design.

Likely follow-ups
"The requirement changes: a regulated customer needs one team's workloads on physically separate nodes with no shared cluster admin. Does your design still hold?"

The namespace model no longer meets the requirement, because a namespace is a soft boundary: the platform team's cluster-admin, the CNI, and the kubelet all cross it. The honest answer is a separate cluster for that team, with its own control plane, node pool, and audit trail, and the same OIDC groups and GitOps structure so the operating model is identical. If a separate cluster is disproportionate, the intermediate step is a dedicated tainted node pool with required affinity, a NetworkPolicy default-deny, the restricted Pod Security level, and an admission policy denying any Pod from other namespaces on that pool; that gives node isolation but still shares the control plane and its admins. I would present both with the cost difference and let compliance choose, and I would document that "no shared admin" is only literally true with the separate cluster.

"What would you cut if you had to deliver access for all 150 engineers in a week?"

I would keep OIDC with group claims and the per-team namespaces, because those are the offboarding story and cannot be retrofitted cheaply. I would cut the just-in-time break-glass workflow and replace it temporarily with a single sre-oncall group holding a production admin binding, audited, with a written promise to replace it within a quarter, and I would make that binding visible in a weekly report. I would cut the audit log shipping to the SIEM and instead enable the API server audit log at Metadata level to cloud storage, so the record exists even if nobody is querying it yet. And I would ship a read-only developer role for production from day one rather than delay production access until the write path through GitOps is polished.

"How do you prevent privilege escalation through RBAC itself?"

RBAC has two built-in escalation checks. A user can only create or update a Role containing permissions they already hold, unless they have the escalate verb on roles, and can only bind a role they already hold all the permissions of, unless they have the bind verb. So a team admin with a namespace role cannot grant themselves cluster-admin. The gaps are elsewhere. The impersonate verb lets a subject act as any user or group, so it must be excluded from every role except a tightly held one. Create on pods with the ability to mount ServiceAccount tokens, or exec into a Pod with a powerful ServiceAccount, effectively grants that account's rights, so I limit which ServiceAccounts exist in a namespace and set automountServiceAccountToken false by default. And I audit RoleBindings to system groups such as system:authenticated regularly.

"How do you test that the RBAC actually matches the design?"

With kubectl auth can-i, driven from a test matrix in CI. The command supports --as user and --as-group group, so the platform repository has a table of identities, verbs, resources, and namespaces with the expected answer, and a job that runs each row against a test cluster built from the same manifests. kubectl auth can-i --list --as-group=oidc:team-payments -n payments-prod prints everything the group can do, and I diff that against an approved baseline so an accidental widening fails the pipeline. For a live check, rbac-lookup or kubectl-who-can answers "who can delete deployments in payments-prod", which is the question an auditor asks. And once a quarter I export all bindings and review any subject that is a User rather than a Group, since those are the ones offboarding misses.

Q37. "How does the Kubernetes API deprecation policy work, and how do you find manifests that will break before you upgrade?"

Reveal answer

Strong answer Each resource is served under versioned API groups — apps/v1, batch/v1, networking.k8s.io/v1 — and the policy is that a stable version is served for at least 12 months or three releases after its replacement goes stable, beta versions for at least 9 months or three releases, and then the old version is removed and the API server rejects it. The famous removals: extensions/v1beta1 Deployments in 1.16, the beta Ingress and CRD versions in 1.22, PodSecurityPolicy in 1.25, the beta HPA in 1.26, and the pattern continues with every release's "removed APIs" note. Objects already stored are not lost — etcd holds them in the storage version and the server converts — what breaks is any client sending the old version: a Helm chart, a CI pipeline, an operator. Finding them before the upgrade: kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis shows which deprecated versions are actually being requested and by which user agent; tools like kubent and Pluto scan manifests, Helm releases, and the live cluster; and the API server's audit log records the version in each request. Managed services surface this too — EKS upgrade insights, GKE deprecation insights. I run those checks a minor version ahead so the fix is a normal change, not an upgrade-day scramble.

Land it Removed APIs break clients, not stored objects — so the pre-upgrade check is "who is still sending the old version", and the metric answers it.

Likely follow-ups
"What is the output of that metric, and how do you turn it into a list of offenders?"

apiserver_requested_deprecated_apis is a gauge with labels group, version, resource, and removed_release, set to 1 when a deprecated version has been requested since the API server started. It tells me which versions are in use but not who is using them. To get the who, I take each combination and search the audit log for requests with that apiVersion in the requestURI, grouped by user agent and user. Without an audit log, the API server logs a warning line at verbosity 3 with the user agent on each deprecated request, and kubectl itself prints a Warning header to the caller. For Helm releases, helm list plus a scan of each release's stored manifest with Pluto shows charts that would fail at upgrade time even if nobody has touched them, which the request metric would miss entirely.

"An operator you depend on still uses a beta CRD version. What are your options before upgrade day?"

First distinguish the operator's own CRDs from its use of Kubernetes APIs. If the operator's CRD defines a v1beta1 that only it serves, nothing in the Kubernetes upgrade removes it, since the deprecation policy applies to built-in APIs and the CRD's versions are the operator's decision. If the operator's code calls a removed built-in API, for example batch/v1beta1 CronJobs, the operator breaks on the upgraded cluster, and the options are to upgrade the operator to a release that uses the current API, to pin the cluster one version back until it does, or to fork and patch it. I check with the operator's compatibility matrix, run it in a staging cluster on the target version, and look for errors from its informers in the logs, which appear immediately as "no matches for kind".

"Does the deprecation policy apply to feature gates and kubelet flags too?"

Not the same policy, and that catches people. Feature gates move alpha to beta to GA and are removed a couple of releases after GA, so a cluster that explicitly sets a gate in its component configuration fails to start when the gate no longer exists; the fix is to remove gates once their feature is GA. Command-line flags for the kubelet and control plane have been progressively moved into configuration files, and removed flags make the binary refuse to start, which is why kubeadm upgrade plan is worth reading. Metrics have their own stability levels, with stable metrics kept and others renamable, so dashboards can break on an upgrade without any API change. And the kubelet must not be newer than the API server and may lag by up to three minor versions as of Aug 2026, which sets the order of a rolling upgrade.

Q38 · Scenario. "The platform team upgraded the cluster overnight. This morning every deploy from one team fails with 'no matches for kind HorizontalPodAutoscaler in version autoscaling/v2beta2'. Running Pods are fine. Diagnose and fix."

Reveal answer

Strong answer Diagnosis order: the symptom — a client-side error naming an API version — is the removed-API case exactly. Evidence: kubectl api-versions | grep autoscaling shows only autoscaling/v1 and autoscaling/v2; the beta version was removed in 1.26, so the team's manifests were carrying a version that had been deprecated for years and the cluster had just crossed the line. Running Pods are unaffected because the stored HPA objects are still there in the storage version and the HPA controller keeps working; only new writes in the old version are rejected. Ranked causes: the team's Helm chart or Kustomize base pins the old version; or a shared internal chart was never updated and this is the first team to deploy after the upgrade — check whether other teams' pipelines will hit it too. Fix: change apiVersion to autoscaling/v2 and adjust the schema (metric targets moved into target.type and averageUtilization), test with kubectl apply --dry-run=server, merge, redeploy. If Helm holds the old version in its release history, helm mapkubeapis rewrites it so upgrades do not fail on the stored release. Prevention: run Pluto or kubent in CI against every chart, check apiserver_requested_deprecated_apis before upgrades, and make the platform team's upgrade checklist include a pre-upgrade scan of every team's live requests.

Land it The cluster did not break the team — the team had been using a removed version with a two-year warning — and the durable fix is the scan in CI, not the one-line edit.

Likely follow-ups
"You fixed the apiVersion but helm upgrade now fails with a different error about the release. What is that?"

Helm stores each release's rendered manifest in a Secret, and on upgrade it reads the previous manifest to compute the three-way diff. If that stored manifest contains autoscaling/v2beta2, Helm asks the API server to interpret it and gets the same "no matches for kind" error, so the upgrade fails before it renders anything. The chart is fine; the release history is the problem. The helm mapkubeapis plugin rewrites the stored release manifests, replacing removed versions with their successors according to a mapping file, after which the upgrade proceeds. The alternative is helm uninstall and reinstall, which is downtime, or editing the release Secret by hand, which is error-prone. This is why the pre-upgrade scan has to include stored Helm releases, not only the chart sources in Git.

"What does the v2 HPA schema change, concretely, beyond the version string?"

In v2beta2 and v2 the metrics list is structured by type. A CPU target that was targetCPUUtilizationPercentage in v1 becomes an entry with type Resource, resource name cpu, and target type Utilization with averageUtilization 60. Custom metrics use type Pods or Object with target type AverageValue or Value, and external metrics use type External. The behavior block with scaleUp and scaleDown policies and stabilizationWindowSeconds exists only in v2. Moving from v2beta2 to v2 is mostly the version string, since the v2 schema stabilised the beta shape, but moving from v1 requires the structural rewrite. kubectl convert was removed from kubectl years ago, so the safe way is to kubectl get the live HPA in autoscaling/v2, which the server converts for you, and use that as the new manifest.

"How do you make sure the other eleven teams are not about to hit the same thing?"

The metric answers that for live requests, but the teams that have not deployed since the upgrade have not made any request yet. So I scan sources: a job that checks out every team's deployment repository and runs Pluto or kubent against the rendered output, and a scan of every stored Helm release across all namespaces with helm list -A piped to a mapkubeapis dry run. I would also look at the last-applied-configuration annotation on live objects, which still carries the version the client last used, with a one-liner over kubectl get hpa -A -o json. Then I post the list, with the fix, before their next deploy rather than after. The prevention is the same scan as a required pipeline check, failing on any API version scheduled for removal in the next two minor versions.

Q39. "What does the kubelet do, exactly, minute to minute? And if the kubelet process dies while containers are running, what happens to them?"

Reveal answer

Strong answer The kubelet's loop, roughly every second: watch the API server for Pods bound to this node; for each one, compare the desired containers with what the container runtime reports, and start, stop, or restart to close the gap; run startup, readiness, and liveness probes on their schedules and act on the results; collect resource usage through cAdvisor; check the eviction signals and evict if a threshold is crossed; mount volumes and refresh ConfigMap and Secret volumes; renew its own client certificate; and post a node heartbeat (a Lease object in kube-node-lease, every 10 seconds) plus a fuller node status every minute. If the kubelet process dies, the containers keep running, because they are children of containerd, not of the kubelet. Nothing on the node changes, but nobody is watching: no probes, no restarts, no eviction, and no heartbeat. After 40 seconds without a heartbeat the Node controller marks the node NotReady; after the five-minute tolerance it starts deleting the node's Pods so their controllers recreate them elsewhere — while the originals keep running, orphaned, until the kubelet returns and kills them. That window is the interesting part: two copies of a singleton can exist, which is why StatefulSets refuse to recreate a Pod until the old one is confirmed gone.

Going deeper Two numbers worth stating precisely as of Aug 2026. The kubelet renews its Lease in kube-node-lease every 10 seconds (nodeLeaseDurationSeconds is 40) and posts a full node status only when something changed or every 5 minutes (nodeStatusReportFrequency), not every minute. The controller manager's --node-monitor-grace-period, the silence after which a node is marked NotReady, was 40 seconds for years and its default was raised to 50 seconds in 1.32, so "about 40 to 50 seconds depending on version" is the safe statement. Then the Node controller adds the node.kubernetes.io/unreachable:NoExecute taint, and the Pods' default 300-second toleration starts the eviction clock. A subtlety that distinguishes a senior answer: those evictions delete the Pod objects, but the kubelet on the silent node still has the containers, and when it reconnects it discovers its Pods are gone and only then kills them, so the duplicate window is the outage length plus the eviction delay, not the eviction delay alone. The kubelet also has --node-status-update-frequency and the lease as separate channels precisely so that a large cluster's heartbeats do not write node status objects into etcd every few seconds.

Going deeper Two numbers worth stating precisely as of Aug 2026. The kubelet renews its Lease in kube-node-lease every 10 seconds (nodeLeaseDurationSeconds is 40) and posts a full node status only when something changed or every 5 minutes (nodeStatusReportFrequency), not every minute. The controller manager's --node-monitor-grace-period, the silence after which a node is marked NotReady, was 40 seconds for years and its default was raised to 50 seconds in 1.32, so "about 40 to 50 seconds depending on version" is the safe statement. Then the Node controller adds the node.kubernetes.io/unreachable:NoExecute taint, and the Pods' default 300-second toleration starts the eviction clock. A subtlety that distinguishes a senior answer: those evictions delete the Pod objects, but the kubelet on the silent node still has the containers, and when it reconnects it discovers its Pods are gone and only then kills them, so the duplicate window is the outage length plus the eviction delay, not the eviction delay alone. The kubelet also has --node-status-update-frequency and the lease as separate channels precisely so that a large cluster's heartbeats do not write node status objects into etcd every few seconds.

Land it The kubelet is the node's eyes and hands, not its heart — lose it and the containers live on unsupervised, which is safer than it sounds for stateless services and dangerous for anything that must be unique.

Likely follow-ups
"What kills the kubelet in practice, and how do you make it resilient?"

The usual killers are the node's own memory pressure when reservations are too small so the kernel OOM-kills it, a full root disk stopping it from writing its state, a certificate that expired because rotation was off, and a bad configuration push that makes it fail on restart. Resilience is mostly outside the kubelet: systemd with Restart=always and a short RestartSec so a crash is a blip, kubeReserved and systemReserved large enough that the kubelet's cgroup is protected, the rotateCertificates and serverTLSBootstrap settings so certificates renew, and disk monitoring with eviction thresholds so the disk never fills. On managed node pools the provider handles this and replaces nodes whose kubelet is unhealthy, which is a reason to let auto-repair stay on. I alert on kube_node_status_condition Ready false for more than two minutes.

"How does the kubelet decide whether a container should be restarted after its own restart?"

On startup it asks the container runtime for every sandbox and container on the node and reconciles that against the Pods the API server says belong to it. For a Pod that still exists with containers running, it adopts them as-is; nothing restarts. For a Pod the API server no longer has, it stops and removes the containers. For a Pod whose containers have exited, it applies restartPolicy with the back-off state it can reconstruct. Because the kubelet keeps almost no state of its own, and the runtime is the source of truth for what is running, this reconciliation is what makes kubelet restarts invisible to workloads. What does get reset is the probe state, so probes start fresh, and a startup probe's budget restarts from zero, which briefly changes readiness on Pods whose readiness probe was failing.

"What happens to a Pod's PersistentVolume while the node is silent and its replacement Pod tries to mount it?"

For a ReadWriteOnce cloud disk, the volume stays attached to the silent node because nobody can confirm it is unmounted. The replacement Pod on another node goes into ContainerCreating with a Multi-Attach error. The attach-detach controller force-detaches after the node has been unreachable for six minutes, which is the default maximum wait, after which the new Pod mounts and starts. That is a deliberate delay to avoid two writers on one disk. The non-graceful node shutdown feature, stable since 1.28, shortens this: if I know the node is dead, I taint it with node.kubernetes.io/out-of-service NoExecute, and the controllers immediately delete the Pods and detach the volumes without waiting. That taint is the sanctioned way to say "I fenced this node", and it is what an automated node problem detector should apply when the cloud confirms the instance is gone.

Q40 · Design. "We are considering self-managing Kubernetes on bare metal instead of EKS or GKE. Design the highly available control plane we would need — and then tell me honestly whether we should."

Reveal answer

Strong answer Requirements: the control plane must survive one machine and one rack failing, upgrades must be routine, and etcd must be recoverable from disaster. Design: three control-plane machines in different racks, each running an API server, controller manager, and scheduler as static Pods managed by kubeadm or a distribution like Talos, with etcd either stacked on the same three machines (simpler) or on three dedicated machines with local NVMe (better isolation for the disk-latency-sensitive component). A load balancer with health checks in front of the three API servers — HAProxy plus keepalived for a floating IP, or the network team's hardware — because the kubelets and clients need one stable endpoint. Controller manager and scheduler use leader election, so only one is active at a time; the API server is stateless and all three serve. Operations: etcdctl snapshot save every 15 minutes to off-site storage with a restore drill each quarter; certificate rotation automated (kubeadm rotates client certs; the CA itself needs a plan before its ten-year expiry); a tested control-plane upgrade procedure one node at a time; monitoring on etcd fsync latency, leader changes, and API server request latency. Honest assessment: this is a permanent two-to-three-engineer job on top of everything else the platform team does, and it buys nothing that the business can see unless there is a real driver — data residency the cloud cannot meet, a bare-metal cost advantage at very large scale, or an air-gapped site. For most companies a managed control plane at a few hundred dollars a month per cluster is the cheapest engineers they will ever hire. I would self-manage only with a named reason, and even then I would start with a distribution and a support contract rather than kubeadm from scratch.

Land it The HA design is three of everything behind a load balancer with etcd on fast local disk and rehearsed restores — and the honest answer is that the managed version is worth every cent unless you can name the reason it is not.

Likely follow-ups
"Stacked or external etcd: what actually changes operationally?"

Stacked etcd runs on the same three control-plane machines as the API server, which kubeadm sets up by default; external etcd runs on three separate machines. Stacked is simpler, three machines instead of six, and the failure domains coincide, so losing one machine costs one API server and one etcd member together. External isolates etcd's disk from the API server's CPU and memory spikes, which matters because a burst of list requests on the API server can starve etcd's fsyncs on shared disk and cause leader elections; it also lets me upgrade the control plane and etcd independently. The cost is more machines and a separate certificate set. My rule: stacked for clusters under a few hundred nodes on machines with dedicated NVMe for etcd, external once the cluster is large, or when the control plane hosts noisy add-ons.

"The requirement changes: it must be air-gapped. What does that add to the design?"

Everything that assumed the internet becomes a component. A private container registry inside the perimeter with every image the cluster needs, including the control plane, CNI, CoreDNS, and metrics images, fed by a mirroring process from an internet-connected staging area with signature verification. A package mirror for the operating system and kubeadm binaries. A Helm chart repository. Time synchronisation from an internal NTP source, because certificate validation breaks with skew. Certificate issuance from an internal CA, and if the distribution phones home for licences, an offline licensing mode. The upgrade path becomes a bundle: images, binaries, and charts for a target version, tested in an air-gapped staging cluster first. Talos and RKE2 have explicit air-gap procedures, which is one more reason to pick a distribution rather than assembling from kubeadm.

"You have a month and must deliver something. What do you cut, and what must you not?"

I would cut external etcd, the hardware load balancer, and multi-rack placement, delivering three control-plane nodes with stacked etcd behind a kube-vip virtual IP on the same machines. I would cut the quarterly restore drill to one initial rehearsal, documented. I would not cut the etcd snapshot schedule to off-node storage, because without it the first disk failure is unrecoverable; I would not cut local NVMe for etcd, because network disk makes the cluster unstable under load in ways that look like random bugs; and I would not cut certificate rotation and the monitoring on etcd fsync latency and leader changes, because those are the two alarms that give warning before an outage. Everything cut is added later without rebuilding, which is the test for what can wait.

"How would you upgrade the control plane with zero API downtime?"

One node at a time, in a fixed order. First etcd if it is a separate version, member by member, checking endpoint health and that the leader is stable between each. Then the control plane: drain nothing, since these are static Pods, but take the node out of the load balancer's rotation, run kubeadm upgrade apply on the first node, and kubeadm upgrade node on the others, verifying with kubectl get --raw /readyz and a watch on apiserver_request_total errors after each. Because the API server is stateless and the other two keep serving, clients see nothing as long as the load balancer's health check pulls a node within a second or two and clients retry. Controller manager and scheduler simply lose and regain leadership. Then the kubelets on the control-plane nodes, and only then the worker pools, oldest first, one minor version per cycle, never skipping.

08 · DrillWorkloads, Probes, Resources & Rollouts — Q41–Q80

This is the section where the interviewer stops asking what things are and starts asking why your service died. Resources and probes cause more self-inflicted Kubernetes outages than everything else combined, and rollouts are where "we have zero-downtime deploys" gets tested against a 2 percent error spike in the graphs. Forty questions: the kernel mechanics under requests and limits, the three probes and the damage from confusing them, the rollout and termination contract, and autoscaling. Answer in the order you would reason at 2 a.m.

Drill · Resources, QoS & the JVM

These questions test whether you know what the kernel does with each number you write under resources, and what a JVM does with the container it finds itself in.

Q41. "A container has a CPU limit of 500m. Its CPU usage graph shows 30 percent. Yet it is being throttled heavily. Explain the mechanism that makes both true."

Reveal answer

Strong answer A CPU limit is enforced by the kernel's Completely Fair Scheduler bandwidth control: a quota per period. The period is 100 milliseconds by default, and a limit of 500m means a quota of 50 milliseconds of CPU time per period, summed across every thread in the container. A JVM has many threads — request handlers, garbage collection workers, JIT compiler threads — and if eight of them run at once, the 50-millisecond quota is consumed in about 6 milliseconds of wall time, and then every thread in the container is paused for the remaining 94 milliseconds of the period. Averaged over a second, usage looks like 30 percent of a core, because the process really did sit idle most of the time — it was forced to. The latency effect is severe: a request that arrives during the paused portion waits up to 94 milliseconds before any thread can run. The metric that shows it is container_cpu_cfs_throttled_periods_total divided by container_cpu_cfs_periods_total, and anything above a few percent for a latency-sensitive service is a problem. Fixes: remove the CPU limit and rely on the request for fair sharing, raise the limit well above the request, or reduce the thread count with -XX:ActiveProcessorCount so bursts are smaller.

Land it Throttling is about bursts within a 100-millisecond window, not average usage — a multi-threaded process can be idle 70 percent of the time precisely because it was throttled.

Likely follow-ups
"Where do you actually see the throttling on the node, and can the period be changed?"

On a cgroup v2 node the container's cgroup directory has a file cpu.stat with nr_periods, nr_throttled, and throttled_usec, and cpu.max holds the quota and period as two numbers, for example 50000 100000 for a 500m limit. cAdvisor reads those into container_cpu_cfs_throttled_periods_total and container_cpu_cfs_throttled_seconds_total, which is what the dashboards use. The period is a kubelet setting, cpuCFSQuotaPeriod, which defaults to 100 milliseconds and can be lowered to 10 or 20 milliseconds; a shorter period means shorter stalls but more scheduler overhead and no change in the average cap. Some platforms set it to 10 milliseconds to make throttling gentler. The other kubelet switch is cpuCFSQuota false, which disables quota enforcement entirely for the node, effectively ignoring all CPU limits, which some batch clusters use deliberately.

"What kernel improvement changed this story, and does it fix it?"

Two things. Kernel 5.14 added CFS burst, cpu.max.burst, which lets a cgroup bank unused quota from previous periods and spend it in a later one, which smooths bursty workloads; Kubernetes has an enhancement proposal to expose it through the Pod spec, but as of Aug 2026 it is not something to rely on in a manifest. Earlier, kernel 5.4 fixed a long-standing bug where quota slices left on idle CPUs were not returned, causing throttling below the limit, which explained many "throttled at 30 percent" graphs on old nodes. Neither changes the basic arithmetic: a JVM with 20 runnable threads and a 500m limit is still throttled hard within every period. The reliable fix remains removing the limit or making it several times the request, and sizing the thread pools to the request.

"If you remove CPU limits, what stops one service from eating the whole node?"

The request. CFS weights each cgroup by its cpu.weight, which the kubelet derives from the CPU request, so when the node is contended every container gets CPU in proportion to its request; a 500m container next to a 2000m container gets one fifth of the contended time, and it always gets at least its request's share. Without contention any container may use idle CPU, which is the point: idle cycles are free. So a runaway service can only take idle capacity, and the moment neighbours want their share, the kernel gives it to them. What limits do not protect against, and requests do, is the scheduler's bookkeeping, which is by request anyway. The one legitimate reason for a CPU limit is predictability for performance testing or a multi-tenant platform that sells fixed cores; for a company's own latency-sensitive services, request without limit is the standard.

"What is the static CPU manager policy, and when would a JVM service want it?"

With the kubelet's cpuManagerPolicy set to static, a Guaranteed Pod that requests an integer number of CPUs gets those cores exclusively: they are removed from the shared pool, pinned through cpuset, and no other container runs on them. The gain is no context switching with neighbours, stable cache behaviour, and no throttling, since a pinned core is fully yours. It suits latency-critical services with predictable load, packet processing, and anything measured in microseconds. For a typical Spring Boot service it is overkill, and it has a real cost: pinned cores are wasted while the service is idle, fractional requests cannot use it, and it requires Guaranteed QoS with integer CPU requests and limits, which reintroduces a CPU limit, though on a pinned core that limit is never hit. The topology manager, alongside it, aligns those cores with NUMA nodes and devices.

Q42. "Which number does the kernel compare against the memory limit when it decides to OOM-kill a container? Is it the same number kubectl top shows, and the same number the JVM knows?"

Reveal answer

Strong answer The memory limit becomes the cgroup's memory.max. The kernel counts everything charged to that cgroup: anonymous memory (the heap, metaspace, thread stacks, native allocations, direct byte buffers), plus file-backed pages the container has touched — the page cache from reading and writing files, including its own logs and any JAR it loaded. When the total hits the limit the kernel first tries to reclaim cache pages; if it cannot reclaim enough, the OOM killer terminates the largest process. What Kubernetes reports as container_memory_working_set_bytes, the number kubectl top and the eviction logic use, is the cgroup total minus inactive file cache — the pages the kernel could drop easily — so it is a close proxy for "what would trigger a kill", and it is the number to alert on. RSS alone undercounts because it ignores active page cache. The JVM knows none of this: it sees its own heap and, with native memory tracking, its metaspace and thread stacks, but it has no view of the page cache or of memory another process in the same container uses. So three numbers, all different: the JVM's heap usage (smallest), the working set (what matters), and the cgroup total (what the kernel reclaims down from).

Land it Alert on working-set bytes against the limit, not on heap — the kernel kills by the cgroup's accounting, and the JVM has never seen that ledger.

Likely follow-ups
"Which process gets killed when the cgroup hits its limit, and does the kubelet see it?"

The kernel picks the process in the cgroup with the highest oom_score, which is essentially the one using the most memory adjusted by oom_score_adj, and in a single-process container that is the JVM. In a container with a shell as PID 1 and the JVM as a child, the JVM dies and the shell may survive, so the container does not exit and Kubernetes never notices; the service is silently dead until the liveness probe catches it. On cgroup v2 with memory.oom.group set to 1, which the kubelet has enabled since 1.28, the kernel kills every process in the cgroup together, so the container exits as a unit and the kubelet records OOMKilled with exit code 137. That is another reason the JVM should be PID 1 through an exec-form entrypoint.

"How do you see, from outside, what the cgroup is charging and to what?"

From a debug session on the node, the container's cgroup directory under /sys/fs/cgroup has memory.current for the total and memory.stat with the breakdown: anon for heap and native allocations, file for page cache, kernel for slab and stacks, and shmem. Comparing anon with the JVM's own accounting from jcmd VM.native_memory tells me whether the gap is inside the JVM or outside it. cAdvisor exposes some of this as container_memory_rss, container_memory_cache, and container_memory_mapped_file, so the same comparison works from Prometheus. The pattern that means "page cache" is a working set that climbs slowly during heavy file I/O and drops when the kernel reclaims; the pattern that means "native leak" is anon rising monotonically while the heap graph is flat.

"Can page cache alone get a container OOM-killed?"

Almost never, because the kernel reclaims clean page cache before killing, so a container that reads large files will approach its limit and then hover as cache is dropped. The exceptions are dirty pages that cannot be reclaimed until written back, so a process writing faster than the disk can absorb accumulates unreclaimable dirty cache and can be killed; and tmpfs or emptyDir with medium Memory, whose contents are charged to the cgroup and cannot be reclaimed at all, so writing a 2 GiB file into a memory-backed emptyDir kills a 2 GiB container. What page cache does do is inflate the working set metric and trigger kubelet eviction, since the kubelet judges by working set, not by the kernel's reclaim decision, so a heavy logger can be evicted for memory it did not really need.

Q43 · Scenario. "A service with a 2 GiB limit gets OOMKilled a few times a day. Heap dashboards show the heap peaking at 1.1 GiB. The team says 'memory usage looked fine'. Diagnose."

Reveal answer

The real test Whether you know the heap is a fraction of the container's footprint, and where the rest hides.

Strong answer I would diagnose in this order:

  1. Confirm the kill. kubectl describe pod shows Last State: Terminated, Reason: OOMKilled, Exit Code: 137. Then pull container_memory_working_set_bytes for the Pod over the day and compare it with the heap graph: I expect the working set to reach 2 GiB at the kill times while the heap stayed near 1.1 GiB.
  2. Find the other 900 MiB. Ranked: metaspace and code cache (a Spring Boot app with many classes uses 150–300 MiB), thread stacks (200 threads at 1 MiB reserved each — Tomcat's default pool plus HikariCP plus schedulers), direct byte buffers from Netty or NIO (unbounded by default, and a classic leak), a native library such as an image codec or a compression library, glibc's malloc arenas fragmenting (visible as RSS growing without JVM accounting), and page cache from heavy file logging inside the container. Turn on -XX:NativeMemoryTracking=summary and jcmd <pid> VM.native_memory from an ephemeral container to see the JVM's own view.
  3. Fix. Set the heap as a percentage that leaves room — MaxRAMPercentage=60 to 70 for a 2 GiB container — cap direct memory with -XX:MaxDirectMemorySize, set MALLOC_ARENA_MAX=2 if glibc is the culprit, reduce thread pools, and if the app genuinely needs 1.9 GiB, raise the limit and the request together.
  4. Prevention. Alert on working set above 85 percent of the limit; load-test with the production limit; add -XX:+ExitOnOutOfMemoryError so heap exhaustion is a clean restart rather than a slow death.

Land it "Memory looked fine" meant the heap looked fine — the kernel counted the other 900 MiB the heap dashboard never shows.

Likely follow-ups
"You set MaxRAMPercentage to 60 and it still gets killed. What next?"

Then the growth is outside the heap and capping the heap only delayed it, so I stop guessing and measure the native side directly. I run the service with -XX:NativeMemoryTracking=summary and take jcmd VM.native_memory baseline early, then jcmd VM.native_memory summary.diff after an hour under load; the category that grows is the culprit: Thread means a thread leak, Internal or Other often means direct buffers, Class means a classloader leak such as repeated Groovy or reflection generation. If NMT shows the JVM flat while RSS grows, the leak is outside the JVM's accounting: glibc arena fragmentation, fixed by MALLOC_ARENA_MAX=2 or switching the base image to jemalloc, or a native library. I would also check the Pod for a second process in the container, such as a log tailer, sharing the limit.

"Why does a JVM often use more RSS than its heap plus metaspace, even with no leak?"

Because several pools are reserved but only counted when touched, and several are outside the JVM's tracking entirely. Thread stacks reserve 1 MiB each but commit only pages used; the code cache holds JIT output up to 240 MiB by default; the garbage collector has its own bookkeeping, and G1 in particular keeps remembered sets that can be 10 percent of the heap; direct byte buffers are capped by MaxDirectMemorySize which defaults to the heap size, so they can double the footprint on paper. Outside the JVM, glibc malloc keeps per-thread arenas that fragment, and mapped JAR files sit in the page cache. A rule of thumb for a Spring Boot service is heap plus 300 to 500 MiB, and the way to size it honestly is to load-test and read the working set, not to add up the theoretical maxima.

"What does ExitOnOutOfMemoryError do to the diagnostics you want?"

It makes a heap-exhausted JVM exit immediately with a non-zero code instead of limping on in a garbage collection death spiral, so the kubelet restarts it and the outage is seconds rather than minutes of timeouts. What it costs is the heap dump, unless I add -XX:+HeapDumpOnOutOfMemoryError with -XX:HeapDumpPath pointing at a volume, since the container's filesystem disappears with the container. On Kubernetes I mount an emptyDir or, better, a persistent volume for dumps and have a sidecar or a CronJob ship them to object storage. The dump can be as large as the heap, so the emptyDir needs a size limit and the write can take a minute, which the terminationGracePeriodSeconds has to allow. For a kernel OOM kill there is no dump at all, which is one more reason to keep the heap safely under the limit so the JVM, not the kernel, sees the exhaustion.

"How do you set the alert so it catches this before the kill?"

The signal is container_memory_working_set_bytes divided by kube_pod_container_resource_limits for memory, per container, and the rule fires when that ratio stays above 0.85 for ten minutes or when its rate of change predicts hitting 1.0 within an hour, using predict_linear. I exclude the first five minutes after a container start because startup footprints are noisy, and I label the alert with the owning team from the namespace. A second, cheaper alert is on kube_pod_container_status_last_terminated_reason equal to OOMKilled, which fires after the fact but catches services nobody has a dashboard for. Both go to the team, not the platform, because the fix is in the manifest and the JVM flags, and the platform's own rule is a monthly report of OOM kills by service so the pattern is visible.

Q44. "Explain the three QoS classes, how the kubelet decides eviction order under node pressure, and why the standard advice is memory request equal to limit."

Reveal answer

Strong answer The kubelet derives a Quality of Service class from the container specs. Guaranteed: every container has CPU and memory requests equal to limits. Burstable: at least one request or limit set, but not the Guaranteed pattern. BestEffort: no requests or limits anywhere. When a node's memory falls below the eviction threshold, the kubelet ranks Pods: first those whose usage exceeds their requests (a BestEffort Pod has a request of zero, so it always exceeds), then by PriorityClass, then by how far above the request they are; it evicts from the top of that ranking. A Guaranteed Pod can only exceed its request by exceeding its limit, which the OOM killer prevents, so it effectively sits at the bottom of the list. The kernel's own OOM killer, used when the kubelet is too slow, follows the same idea through oom_score_adj: Guaranteed Pods get the lowest score, BestEffort the highest. Setting memory request equal to limit therefore means the Pod's reservation is honest — the scheduler reserves what the container may actually use — and the Pod is never "over its request", so it is evicted last. The reason not to do the same for CPU is the throttling story: a CPU limit hurts latency, and CPU eviction does not exist, so a CPU request without a limit is the better trade for latency-sensitive services, which lands them in Burstable but still protected on memory.

Land it Your memory request is your place in the eviction queue — make it equal to the limit and you are last in line, while leaving CPU uncapped keeps the JVM fast.

Likely follow-ups
"Give the exact eviction thresholds and what soft versus hard eviction changes."

The kubelet's evictionHard defaults are memory.available below 100Mi, nodefs.available below 10 percent, imagefs.available below 15 percent, and nodefs.inodesFree below 5 percent. Crossing a hard threshold evicts immediately with no grace period beyond what evictionMaxPodGracePeriod allows, which is zero by default, so the Pod is killed abruptly. evictionSoft thresholds are optional and paired with evictionSoftGracePeriod: a soft memory threshold at 500Mi with a 90-second grace means the condition must persist for 90 seconds before eviction, and the Pod then gets a proper termination with its grace period. Managed providers usually set only the hard ones. I set a soft memory threshold above the hard one on self-managed nodes so that a slow leak leads to a graceful eviction and a node-pressure event I can alert on, rather than a SIGKILL.

"How would you verify a Pod's QoS class and its oom_score_adj on a live node?"

The class is in the Pod's status, kubectl get pod -o jsonpath='{.status.qosClass}'. The kernel value is per process: from a debug session on the node, find the container's main PID with crictl inspect, then read /proc/PID/oom_score_adj. Guaranteed Pods get -997, BestEffort gets 1000, and Burstable gets a value between 2 and 999 computed as 1000 minus a thousand times the memory request divided by the node's allocatable, so a Burstable Pod with a large request is close to Guaranteed and one with a tiny request is close to BestEffort. That formula is why a small memory request is doubly harmful: it puts the Pod first in the kubelet's queue and high in the kernel's. I also confirm the cgroup layout with the cgroup path in the inspect output, which contains kubepods-burstable or kubepods-besteffort.

"What is the difference between kubelet eviction and the kernel OOM killer, in what the Pod experiences?"

Kubelet eviction is a Kubernetes-level action: the Pod's status becomes Failed with reason Evicted and a message naming the resource, the container gets SIGTERM and the eviction grace period, the Pod's controller creates a replacement elsewhere, and the evicted Pod object remains for inspection until garbage collected. The kernel OOM killer acts on a single container that exceeded its own limit, or on a process when the whole node is out: the container exits with 137 and OOMKilled, the kubelet restarts it in place under restartPolicy, the Pod is not rescheduled, and the restart count climbs. So an OOMKilled container means "this container's limit", an Evicted Pod means "the node ran short", and the remedies differ: raise the limit versus raise the request or fix a neighbour.

Q45 · Scenario. "A platform policy now requires CPU limits on every container. Since it was applied, a Spring Boot service's p99 latency doubled and startup takes three times longer. CPU usage in the graphs is unchanged. Explain and negotiate a fix."

Reveal answer

Strong answer Diagnosis order: the symptom pattern — unchanged average usage, worse tails, slower startup — is CFS throttling. Evidence: the throttled-periods ratio for the container, which I expect above 20 percent; and a startup timeline showing class loading and JIT compilation, which are multi-threaded bursts, now stretched because every burst hits the quota. Cause: the policy set a limit close to the request (say request 500m, limit 1), and a JVM with 10 compiler and GC threads exhausts a 100-millisecond quota in a fraction of the period. Fix, in negotiating order: first, propose that the policy require limits at least 2× or 3× the request rather than equal, which keeps a cap while leaving burst room — that is often enough. Second, reduce the JVM's parallelism with -XX:ActiveProcessorCount=2 and smaller GC and compiler thread counts so bursts fit the quota; and consider a startup probe with a longer budget. Third, argue for exempting latency-sensitive services from CPU limits entirely, using the CPU request plus a ResourceQuota on the namespace as the fairness mechanism, since the request already guarantees a proportional share under contention. Prevention: a throttling alert as a standard part of every service's dashboard, and a platform standard that documents why memory limits are mandatory and CPU limits are optional.

Land it The policy confused fairness with capping — the request already delivers fairness, and the cap is what doubled the latency.

Likely follow-ups
"The platform team refuses to drop the policy because of a multi-tenant fairness incident. What do you propose?"

I would separate their real goal from the mechanism. Their incident was one tenant consuming a node's CPU and starving others; that is what requests already solve under contention, because CFS weights guarantee each container its requested share. So I propose a policy that enforces honest requests instead: a LimitRange minimum CPU request, a ResourceQuota per namespace on requests, and an admission rule that a container's limit, if set, must be at least three times its request. That keeps a cap for teams who want one and stops the throttling for those who do not. If they insist on a universal limit, I ask for the kubelet's cpuCFSQuotaPeriod to be lowered to 10 milliseconds across the fleet, which shortens each stall, and I ask for a written exemption process with a throttling dashboard as the evidence to grant one.

"How would you prove, with data, that the limit caused the latency?"

With a controlled comparison rather than a graph over time. Take two Pods of the same version, one with the limit and one without, on the same node pool, and send them identical load from a load generator for fifteen minutes; compare p99 latency, startup time to readiness, and the throttled-periods ratio. In production, the before-and-after overlay of the throttling ratio and p99 around the policy's rollout time is the observational version. I would also show a flame graph or a JFR recording from the throttled Pod, where the CPU-sampled stacks show idle gaps rather than hot code, and the JVM's own safepoint and GC pause logs show pauses stretched to multiples of the period. That reframes the conversation from opinion to a reproducible measurement the platform team can run themselves.

"Why does startup suffer even more than steady state?"

Startup is the most parallel moment in a JVM's life. Class loading, bytecode verification, C1 and C2 compilation on several compiler threads, and Spring's context refresh all run concurrently, so a quota sized for steady-state request handling is exhausted in the first few milliseconds of every period. A 500m limit gives 5 percent of one core per hundred milliseconds when eight threads are runnable, so a startup that needs 60 CPU-seconds of work takes minutes of wall time. The knock-on effects are a startup probe that expires and restarts the Pod, a rollout that crawls, and an HPA scale-up that arrives too late. Fixes specific to startup are a larger limit with the same request, fewer compiler threads via -XX:CICompilerCount, and ahead-of-time approaches that move the work out of startup entirely.

Q46. "How does the JVM decide its heap size inside a container, and which flags do you set for a Kubernetes-hosted Spring Boot service?"

Reveal answer

Strong answer Since JDK 10 the JVM is container-aware: it reads the cgroup memory limit and CPU quota (cgroup v2 support since JDK 15, and every current Kubernetes node uses cgroup v2) instead of the host's totals. By default it sets the maximum heap to one quarter of the container's memory limit — a 1 GiB container gets a 256 MiB heap — which is far too small for a service and is the source of many "it is slow on Kubernetes" complaints. The flags I set through JAVA_TOOL_OPTIONS, so they apply without touching the image's entrypoint: -XX:MaxRAMPercentage=70, so the heap tracks the limit and leaves room for off-heap; -XX:+ExitOnOutOfMemoryError, so a full heap causes a restart the kubelet can count instead of a zombie service; -XX:ActiveProcessorCount=N, matched to the CPU request, so GC and common pools are sized for the share the container will really get rather than the node's core count; -XX:MaxDirectMemorySize if Netty is involved; and the GC choice — G1 by default, or ZGC for large heaps where pause time matters more than throughput. I avoid -Xmx in absolute terms, because it silently diverges the moment someone changes the limit in the manifest.

Land it Percent-of-limit for the heap and a processor count that matches the request are the two flags that make a JVM behave like it knows where it is running.

Likely follow-ups
"What does ActiveProcessorCount change inside the JVM, and what if you leave it unset with no CPU limit?"

It sets the number Runtime.availableProcessors returns, which sizes the G1 and parallel GC worker threads, the JIT compiler thread count, the common ForkJoinPool, and anything in the application that sizes pools from it, such as Tomcat's default or Netty's event loop count. With no CPU limit, the container-aware JVM sees the node's core count, so a service requesting 500m on a 32-core node sizes itself for 32 cores: dozens of GC threads and a huge ForkJoinPool, all sharing half a core under contention. That is slow and memory-hungry. So I set ActiveProcessorCount to about the request rounded up, 2 for a 500m to 1000m service. With a CPU limit set, the JVM derives the count from the quota, so a 2000m limit gives 2, which is one of the few things a limit gets right.

"Why JAVA_TOOL_OPTIONS and not JAVA_OPTS or the Dockerfile?"

JAVA_TOOL_OPTIONS is read by the JVM itself on startup, regardless of how it was launched, so it works with any entrypoint, with tools like jcmd, and with base images I do not control. JAVA_OPTS is only a convention that some start scripts honour, so it silently does nothing if the entrypoint does not reference it. Putting flags in the Dockerfile ties them to the image, but the right values depend on the manifest's resources, which differ per environment, so an environment variable set from the Deployment keeps flags and resources side by side in the same file. The one caveat is that JAVA_TOOL_OPTIONS is printed to stderr on startup as "Picked up JAVA_TOOL_OPTIONS", which is harmless but confuses log parsers, and it applies to every JVM in the container, including a jcmd I run for diagnostics.

"Would you choose ZGC or G1 for a typical Spring Boot service, and how do you decide?"

G1 for most services under about 8 GiB of heap, because its throughput is slightly better and its pauses at that size are usually 20 to 100 milliseconds, which is fine for a p99 target of a few hundred milliseconds. Generational ZGC, the default ZGC mode since JDK 23, when pauses matter more than throughput: heaps above 8 GiB, latency targets under 50 milliseconds, or a service where GC pauses were visible in the p99. ZGC uses more memory headroom and a few percent more CPU for its concurrent work, so I would raise the memory limit by 10 to 15 percent. The decision is made from data: enable GC logging with -Xlog:gc to a file or stdout, load-test, and look at the pause histogram; if p99 pause is already under the budget with G1, there is nothing to gain from switching.

"What does the JVM do if the container's memory limit changes at runtime through in-place resize?"

Nothing. The JVM reads the cgroup limit once when it starts to compute the maximum heap from MaxRAMPercentage, and it never rereads it, so a grown container has a JVM that still refuses to grow its heap and a shrunk container has a JVM that will happily exceed the new limit and be OOM-killed. There is no flag to make the heap maximum dynamic as of Aug 2026. So a memory resize on a JVM Pod must be accompanied by a container restart, which is what a resizePolicy of RestartContainer for memory expresses, and the VPA in in-place mode should respect it. For CPU the picture is better: the JVM also reads the quota once for its thread counts, but the kernel enforces the new quota immediately, so a CPU increase helps throughput even if the thread pools are sized for the old value.

Q47 · Design. "Design the process — not just the numbers — by which a team arrives at correct requests and limits for a new Spring Boot service, and keeps them correct as the service changes."

Reveal answer

Strong answer Requirements: settings that keep the Pod alive under real load, do not waste cluster capacity, and do not rot. Design, in phases. Start with a defensible guess from the platform's base chart: memory request equal to limit at 1.5 GiB for a typical Spring Boot service, CPU request 500m, no CPU limit, heap at 70 percent. Load-test in staging at the production limit with the production JVM flags, watching working-set memory, throttling, and GC logs; raise or lower the memory limit until working set peaks at around 75 percent of it. Ship, then run the Vertical Pod Autoscaler in recommendation-only mode (updateMode: Off) against every Deployment; it observes usage over days and publishes suggested requests without acting. Review those recommendations in a monthly platform report per team, and let a bot open a pull request against the GitOps repository when the recommendation differs from the manifest by more than 30 percent — the human merges. Guard rails: a LimitRange so nothing lands as BestEffort, a ResourceQuota per namespace, an alert on working set above 85 percent and on throttling above 5 percent, and a rule that any change to resources goes through the same PR path as code. Trade-offs: VPA in automatic mode would restart Pods to apply changes and fights the HPA on CPU, so I keep it advisory; in-place resize (beta since 1.33) may let it act without restarts in future. What I would not do: copy another service's numbers, set CPU limits by policy, or let the numbers be tuned by hand in the cluster where GitOps will revert them.

Land it Measure at the production limit, let VPA recommend, and route the recommendation through a pull request — the numbers stay right because the process is a loop, not a one-time guess.

Likely follow-ups
"The requirement changes: the service's traffic doubles at quarter-end. How does the process account for that?"

The VPA's recommendation is a percentile over a rolling history, by default the 90th percentile of the last eight days with older samples weighted down, so a quarterly peak is forgotten by the time it returns. The process needs two additions. First, the load test in staging runs at the quarter-end profile, not the average, and the memory limit is set from that peak, since memory is not something the HPA can fix by adding Pods if each Pod is undersized. Second, the horizontal dimension handles the CPU side: the HPA on request rate scales replicas at quarter-end, with maxReplicas sized from the same load test. I would also keep the VPA's recommendation per-quarter in the platform report, so the bot's pull request does not propose shrinking the memory limit in a quiet month. The general rule is that the memory limit is sized for the worst hour, and the replica count for the rest.

"What would you cut if the platform team has no time to build the recommendation pipeline?"

I would cut the bot and the monthly report and keep the VPA objects in Off mode, because the recommendation is then visible to anyone with kubectl describe vpa, and I would add a single dashboard panel per service showing request versus recommendation versus working set. I would keep the LimitRange and ResourceQuota, which are two small manifests and stop the worst outcomes, and the two alerts on working set and throttling. I would cut the staged load test to a smoke test at the production limit for the first release only. The thing I would not cut is the rule that resources are changed through the pull request path, because tuning by hand in the cluster is exactly the drift that makes every later step meaningless.

"How do you know when the numbers are wrong, before an incident?"

Four signals, all cheap. Working set above 85 percent of the memory limit says the limit is too tight. Working set below 40 percent of the request for a week says memory is over-reserved and the cluster is paying for it. Throttling above 5 percent, if there is a CPU limit, says the limit is wrong. And CPU usage above the request for sustained periods says the request is dishonest, which shows up first as scheduling packing too many such Pods on one node and the node's load average climbing. I chart these as a fleet-wide table sorted by the worst offender, which is what the monthly review reads. The VPA's recommendation diverging from the manifest by more than 30 percent in either direction is the same information distilled into one number.

Q48 · Scenario. "During an incident, a node hit memory pressure and the kubelet evicted the payments service Pods while a developer's ad-hoc debugging Pod with 4 GiB in use survived. Why, and what was misconfigured?"

Reveal answer

Strong answer Diagnosis order: the symptom contradicts the usual rule that BestEffort Pods go first, so something made the payments Pods rank worse. Evidence: kubectl get pod -o jsonpath='{.status.qosClass}' for both, the requests on each, and the eviction events with their reasons. Likely causes, ranked. One: the debugging Pod was not BestEffort at all — the namespace's LimitRange gave it a default request, or the developer copied a manifest with a 6 GiB request — so it was Burstable and under its request, while the payments Pods had a 1 GiB request but were using 1.8 GiB with a 2 GiB limit, so they were "over request" and ranked first. Two: PriorityClass — the debugging Pod carried a high priority someone set as a template default, and priority is the second sort key. Three: the payments Pods simply had a much larger excess over their request in absolute terms, which is the third sort key. The misconfiguration is therefore almost always on the payments side: a memory request far below real usage, which both invited overcommit on the node and put them at the front of the eviction queue. Fix: request equal to limit for payments, and a low-priority class plus a tight LimitRange maximum for the debug namespace. Prevention: an admission policy that rejects production Deployments whose memory request is below their limit, and no ad-hoc Pods in production namespaces at all.

Land it The kubelet evicted the Pod that was furthest over its promise, and payments had made a promise it was breaking — the debug Pod, oddly, had not.

Likely follow-ups
"How do you read the eviction decision after the fact?"

The evicted Pod's status has reason Evicted and a message such as "The node was low on resource: memory. Container payments was using 1850Mi, request is 1024Mi, has larger consumption of memory", which names exactly the usage-over-request comparison the ranking used. The node has an event with reason EvictionThresholdMet, and its MemoryPressure condition flips True with a timestamp. The kubelet log at that time lists the ranked candidates if verbosity is at least 3. From Prometheus, kube_pod_status_reason with reason Evicted and kube_node_status_condition for MemoryPressure line up the timeline, and container_memory_working_set_bytes for every Pod on that node in the minutes before shows who was over their request and by how much. That last chart is what settles the argument about which team's configuration was wrong.

"Why was a Pod using 4 GiB not the problem, if it was under its request?"

Because the node was overcommitted by requests, not by that Pod's behaviour. The scheduler placed Pods on the node such that the sum of requests fit allocatable; if the debug Pod requested 6 GiB and used 4, it consumed less than the scheduler had set aside for it. The payments Pods requested 1 GiB and used 1.8 GiB each, so several of them together used far more than the scheduler had counted, and that is what put the node under pressure. From the kubelet's point of view, the Pods breaking their promise are the cause and the first to go. The debug Pod's sin is different: a 6 GiB request for a debugging session wastes cluster capacity, which a LimitRange maximum in that namespace should have blocked, but it did not cause the pressure.

"What admission policy would you write, and how do you roll it out without breaking existing services?"

A ValidatingAdmissionPolicy in CEL, matched to Deployments and StatefulSets in production namespaces, with an expression over every container asserting that resources.requests.memory equals resources.limits.memory and that both are present. I would bind it first with validationActions set to Warn and Audit, so applies succeed but the warning is printed to the user and logged in the audit log, and I would collect the audit entries for two weeks to produce a list of non-compliant services with their owners. After those are fixed through pull requests, I switch the binding to Deny. A paramRef could hold exceptions by namespace for the rare legitimate case, with an expiry date in the annotation that a scheduled job enforces. This is the standard pattern for any new policy: warn, measure, fix, enforce.

Q49. "What does in-place Pod resource resize change, and where does it not help?"

Reveal answer

Strong answer Historically a Pod's resources were immutable, so changing a request or limit meant a new Pod — for a Deployment, a rolling restart. In-place resize, beta and on by default since 1.33, makes resources mutable through the resize subresource: the kubelet adjusts the cgroup limits of the running container, and a per-container resizePolicy says whether a restart is needed for each resource — CPU can usually change live, and memory decreases may require a restart because the kernel cannot take back memory a process holds. The Pod's status reports the resize as in progress, deferred (the node lacks room right now), or infeasible (it will never fit). What it changes: a Vertical Pod Autoscaler can adjust requests without restarts, and an operator can grow a database Pod's memory during a batch window and shrink it after. Where it does not help: the JVM sized its heap at startup from the limit it saw then, so growing the container's memory does not grow the heap until a restart; the scheduler still needs the new request to fit on the current node, so a large increase on a full node is deferred rather than migrated; and Deployments still manage the template, so a resize done by hand is reverted by the next rollout unless the template changes too.

Land it Resize removes the restart for the cgroup, not for the process — a JVM still has to be reborn to see a bigger world.

Likely follow-ups
"Show the resize in practice: the command, the fields, and what you watch."

With kubectl 1.33 or later the command is kubectl patch pod orders-7d9 --subresource resize with a patch that sets spec.containers[0].resources.requests.memory and limits to the new value; older clients need the raw subresource. The Pod spec gains resizePolicy per container, a list of resourceName and restartPolicy pairs, where restartPolicy is NotRequired, the default, or RestartContainer. After the patch I watch the Pod's conditions: PodResizePending with reason Deferred or Infeasible, or PodResizeInProgress while the kubelet applies it, and then status.containerStatuses[].resources, which reports the actual applied values rather than the spec. The allocatedResources field shows what the kubelet has admitted. If the condition stays Deferred, the node lacks room and nothing will happen until something else leaves, which is when I fall back to a rolling restart.

"Can you shrink memory in place, and what happens if the process is using more than the new limit?"

The API allows a memory limit decrease, but the kubelet applies it carefully: as of Aug 2026 it refuses to lower memory.max below the container's current usage, leaving the resize in progress until usage drops, rather than triggering an immediate OOM kill. If the resizePolicy for memory is RestartContainer, the container is restarted with the new limit instead, which is the right choice for a JVM since its heap was sized from the old limit anyway. Decreasing the request is always allowed since it is only bookkeeping. The practical rule: memory up in place is safe for processes that allocate dynamically, memory down needs a restart for a JVM, and CPU in either direction is safe because the kernel applies the new quota and weight immediately.

"Does in-place resize change how you write the VPA or the Deployment template?"

The VPA gains an updateMode InPlaceOrRecreate, beta in the VPA project as of Aug 2026, which tries a resize first and evicts only when the resize is infeasible or the container's policy demands a restart. To make that useful for a JVM I set resizePolicy with cpu NotRequired and memory RestartContainer, so CPU adjustments are free and memory adjustments restart the one container without rescheduling the Pod. The Deployment template still holds the baseline resources, and the VPA's admission webhook rewrites new Pods at creation, so the template and the live Pods will differ; that is expected and the GitOps tool must ignore live resource differences on Pods, which it does since it compares Deployments. What I would not do is hand-resize Pods of a Deployment, because the next rollout recreates them from the template.

Q50. "LimitRange, ResourceQuota, and the Vertical Pod Autoscaler all touch resources. What does each do, and how do they interact?"

Reveal answer

Strong answer A LimitRange is per namespace and acts at admission on individual containers: it fills in default requests and limits when a manifest omits them, and it rejects containers whose requests or limits fall outside a minimum and maximum, or whose limit-to-request ratio is too high. It is the tool that guarantees nothing in the namespace runs as BestEffort. A ResourceQuota is also per namespace but aggregates: the sum of requests and limits across all Pods, plus counts of objects such as Pods, Services of type LoadBalancer, and PersistentVolumeClaims, may not exceed the quota. Once a quota for a resource exists, every Pod must specify that resource or be rejected — which is why LimitRange defaults and quotas are usually deployed together. The VPA is a controller, not admission policy: it watches usage history and either recommends requests or rewrites them, and in automatic mode evicts Pods to apply them. Interactions to know: VPA recommendations are capped by the LimitRange maximum and must fit the remaining quota, or the Pod will not be admitted after eviction; the LimitRange default only applies when a field is absent, so a chart that sets a tiny explicit request bypasses it — a maximum ratio catches that; and quota is checked against requests, so teams can consume more real memory than their quota if they set requests low, which is one more reason for request-equals-limit on memory.

Land it LimitRange shapes each container, ResourceQuota bounds the namespace's total, and VPA moves the numbers over time — deploy the first two together and let the third advise.

Likely follow-ups
"Write the LimitRange you would put in every production namespace, and defend each number."

A LimitRange with type Container, defaultRequest of cpu 250m and memory 512Mi, default limits of memory 512Mi and no CPU limit, min of cpu 50m and memory 64Mi, max of cpu 8 and memory 16Gi, and maxLimitRequestRatio of memory 1 and cpu 4. The defaults exist so a container with nothing specified is Burstable with an honest starting point rather than BestEffort. The minimums stop a request of 1m that games the scheduler. The maximums stop a single container from claiming a whole node by accident; a legitimately large service gets an exception in its own namespace. The memory ratio of 1 enforces request equals limit, and the CPU ratio of 4 permits burst room while stopping a 10m request with a 4-core limit. Pod-level type limits cap the sum across containers so a sidecar-heavy Pod cannot exceed a node.

"A team's deploy is rejected with 'exceeded quota'. Walk through what they should check and what you would not do."

kubectl describe quota in the namespace shows each resource's used and hard values, and the rejection message names the resource, for example requests.memory. The team should compute the new Deployment's total request times replicas plus surge, since a rolling update with maxSurge briefly needs the extra Pods' requests within the quota, and that surge is the usual reason a deploy fails when steady state fits. They should also look for consumers they forgot: finished Jobs' Pods that were never cleaned up still count until deleted, and Pending Pods count too. What I would not do is raise the quota on request during the deploy; the quota is a capacity agreement, and the right path is either a request through the platform's capacity process, with usage data, or right-sizing the team's other services which are usually over-requested.

"How does the VPA rewrite a Pod's resources if the template belongs to the Deployment?"

Through a mutating admission webhook. When the ReplicaSet controller creates a Pod, the VPA's admission controller intercepts the create, looks up the VerticalPodAutoscaler object matching the Pod's owner, and patches the container resources to the current recommendation before the Pod is stored. The Deployment's template is never changed, which is why kubectl get deploy shows the old numbers while kubectl get pod shows the new ones. In Auto or Recreate mode, the VPA updater evicts Pods whose live resources differ from the recommendation by more than a threshold, respecting the PDB and a minimum replica count, and the recreated Pods pass through the webhook. The consequences: the webhook must be highly available or Pod creation fails, and the recommendation's limits, set by resourcePolicy minAllowed and maxAllowed and by the LimitRange, bound what it may write.

Drill · Probes and crash loops

This group tests whether you can say what each probe is allowed to check, and whether you can read a crash loop from the outside in.

Q51. "Startup, readiness, liveness — what question does each answer, what happens on failure, and what is each allowed to depend on?"

Reveal answer

Strong answer The startup probe asks whether the process has finished starting; while it fails, the other two probes are held off, and if it exceeds its failure threshold the container is restarted. It exists to give slow starters a long budget without loosening the liveness probe. The readiness probe asks whether this Pod may receive traffic right now; on failure the Pod is removed from every Service's endpoints and from the Deployment's available count, and nothing is restarted; when it passes again the Pod is added back. It may depend on anything that determines whether a request would succeed — a warmed cache, a connected database pool, an overload flag. The liveness probe asks whether the process is stuck in a way only a restart fixes; on failure the container is killed and restarted. It must depend only on the process itself — an HTTP handler that returns 200 proves the server thread pool is alive, and that is all it should prove. The rule that prevents the classic disaster: liveness never checks a dependency, because if it did, a slow database would restart every Pod at once and turn a slow dependency into a total outage. Spring Boot's actuator exposes exactly this split as /actuator/health/liveness and /actuator/health/readiness, with readiness controllable from application code.

Land it Readiness protects traffic and may look outward; liveness protects against deadlock and must look only inward — swap those and you have built a restart bomb.

Likely follow-ups
"What are the default probe timings, and which one is the trap?"

For every probe the defaults are initialDelaySeconds 0, periodSeconds 10, timeoutSeconds 1, successThreshold 1, and failureThreshold 3. So a liveness probe with defaults restarts a container after three consecutive failures ten seconds apart, about 30 seconds of unresponsiveness, and a readiness probe removes a Pod after the same 30 seconds and restores it after one success. The trap is timeoutSeconds 1: any endpoint that occasionally takes more than a second, because of a GC pause, a busy thread pool, or a slow dependency in the readiness group, counts as a failure, and three such moments in a row restart or unroute a healthy Pod. I set timeoutSeconds to 3 or 5 on JVM services, and successThreshold must be 1 for liveness and startup, the API enforces it.

"What about exec, TCP, and gRPC probes, and why would you avoid exec?"

An httpGet probe is the kubelet making an HTTP request and treating 200 to 399 as success. A tcpSocket probe only checks that the port accepts a connection, which proves the listener exists and nothing more, useful for a database or a proxy without an HTTP endpoint. A grpc probe, stable since 1.27, calls the standard gRPC health service and needs no sidecar. An exec probe runs a command inside the container, and I avoid it for two reasons: it forks a process through the container runtime every period, which on a node with a hundred Pods is a measurable CPU cost and a known source of runtime latency, and the command inherits the container's resource limits so a throttled container fails its own probe by being slow to fork. When there is no choice, keep the exec cheap and the period long.

"Why does readiness not restart the container, and what if readiness fails forever?"

Because the readiness answer is about traffic, not health; a Pod refusing traffic while it warms a cache or waits for a dependency is behaving correctly, and restarting it would only repeat the wait. So a Pod whose readiness fails forever simply sits Running and not Ready, receiving no traffic, counted as unavailable by the Deployment and blocking the rollout's progress. That is visible: kubectl get pods shows 0/1 in the Ready column, rollout status hangs, and after progressDeadlineSeconds the Deployment's Progressing condition goes False. Nothing kills it, which is a feature, because the alternative, killing every Pod whose dependency is slow, is the restart storm. The operational answer is an alert on Pods not Ready for more than a few minutes, and a readiness endpoint whose response body says which indicator is failing.

"How do the probes interact with a Pod that has several containers?"

Probes are per container, and the Pod is Ready only when every container is Ready, so a sidecar with a failing readiness probe takes the whole Pod out of rotation even if the application is fine. Liveness is per container too: the kubelet restarts the failing container alone, the others keep running, and the Pod keeps its IP. This is why a mesh proxy needs its own accurate readiness, and why a logging sidecar should usually have no readiness probe at all, since its health should not gate the application's traffic. Readiness gates extend the Pod-level condition further: a readinessGates entry names a condition that an external controller, such as the AWS load balancer controller, must set True before the Pod is Ready, which is how load balancer registration becomes part of readiness.

Q52 · Scenario. "The database had a 30-second slowdown. Ten minutes later the entire service tier is still down, every Pod restarting constantly, and the database is now fine. What happened?"

Reveal answer

Strong answer Diagnosis order: the symptom — restarts outliving the trigger — points to a liveness probe that checks the database. Evidence: kubectl describe pod shows Liveness probe failed: HTTP probe failed with statuscode: 503 events followed by Killing, and the actuator health endpoint used by liveness includes the datasource health indicator. The cascade: during the slowdown, health checks timed out, every Pod's liveness failed three times, and the kubelet restarted all of them within the same minute. Each restarting JVM then took 60–90 seconds to boot and open a fresh HikariCP pool, and on boot the readiness endpoint — also checking the database — hit a database that was now being hammered by dozens of simultaneous pool warm-ups plus retried client traffic, so the liveness probe failed again before startup finished, restarting again. The feedback loop sustains itself after the original cause is gone. Immediate fix: patch the liveness probe to a path that does not check dependencies (/actuator/health/liveness) or temporarily lengthen its failureThreshold, and scale the Deployment down and back up so the Pods boot in waves rather than all at once. Permanent fix: liveness checks only the process; readiness may check the database; a startup probe with a generous budget; and connection-pool warm-up that does not block readiness. Prevention: a rule in the platform chart that liveness paths are never the full health endpoint, and a game day that slows the database on purpose.

Land it A liveness probe that checks a dependency converts every dependency blip into a synchronised restart storm — the database recovered, and the probes kept the outage going by themselves.

Likely follow-ups
"You changed the liveness path and the restarts continue. What else is going on?"

If the new liveness probe only checks the process and Pods still restart, either the change has not reached them, or the restarts have a different cause. First I confirm the live Pods have the new probe with kubectl get pod -o yaml, because a Deployment edit only affects new Pods, and a GitOps agent may have reverted my patch. Then I read the exit code: 143 with a Killing event and a probe failure message means a probe; 143 without one means something else sends SIGTERM, such as the VPA evicting; 137 with OOMKilled means memory, and a fleet restarting into a cold state uses more memory at once; 1 means the application is crashing, perhaps on a database pool that cannot initialise. The startup probe is another suspect: if its budget is shorter than boot time under this load, it restarts the container just as liveness would.

"How do you break the restart storm right now, in the next two minutes?"

Two moves that need no redeploy. First, kubectl patch the Deployment's liveness probe to a failureThreshold of 30, which the controller rolls out; but a rollout under a crash loop is slow, so the faster move is to scale the Deployment to zero and back to a small number, three Pods, wait for them to be Ready, and then scale up in steps. That gives each wave a database that is not being hammered by every other Pod's pool warm-up. In parallel I would shed client load at the gateway with a rate limit so the retried traffic stops amplifying the problem. Once stable, I fix the probe properly in Git. What I would not do is delete Pods one by one, because the ReplicaSet recreates them into the same storm.

"Isn't a readiness probe that checks the database also a cascading failure risk?"

It is, in a milder form. If every Pod's readiness fails when the database is slow, every Pod leaves the endpoints, the Service has no backends, and clients get connection refused from kube-proxy or 503 from the gateway. That is a total outage of the service for the duration of the database problem, but it is also arguably correct, because those requests would have failed anyway, and unlike liveness it self-heals the instant the database recovers, with no restart and no warm-up. The refinement is to keep the readiness check cheap, with a short timeout, and to consider whether partial function is possible: an order service that can serve reads from a cache might stay Ready and fail only writes. Spring lets the readiness group include only the indicators I choose, so that is a per-service decision, not a default.

Q53. "How can a Spring Boot service use the readiness probe to shed load or to drain itself, and what does Spring do automatically on SIGTERM?"

Reveal answer

Strong answer Spring Boot models readiness as an application state, ReadinessState.ACCEPTING_TRAFFIC or REFUSING_TRAFFIC, exposed at /actuator/health/readiness. Application code can publish a state change through AvailabilityChangeEvent.publish(context, ReadinessState.REFUSING_TRAFFIC), which flips the endpoint to 503; the kubelet's next readiness check fails, the Pod leaves the Service endpoints, and traffic routes to other replicas — with no restart. Uses: a cache warm-up that refuses traffic until it is loaded; a circuit-breaker state that says this instance's downstream is unhealthy; an overload signal when the request queue exceeds a threshold, which is a crude but effective back-pressure mechanism. On SIGTERM, Spring Boot with server.shutdown=graceful does three things in order: it sets readiness to refusing traffic, so the probe starts failing immediately; it stops accepting new connections on the server port while letting in-flight requests complete, up to spring.lifecycle.timeout-per-shutdown-phase; and then it closes the application context, which closes the connection pools. The catch is the same race as always: the readiness flip only helps once the kubelet has probed and the endpoint change has propagated, which is why the preStop sleep still matters even with graceful shutdown enabled.

Land it Readiness is the application's own hand on the traffic switch — Spring flips it for you on shutdown, and you can flip it yourself for overload or warm-up.

Likely follow-ups
"How long does it take, end to end, from flipping readiness to no new requests arriving?"

Add up the hops. The kubelet probes on its period, so up to periodSeconds, say 5, before it sees the 503, times failureThreshold if greater than 1, so with a threshold of 2 that is up to 10 seconds. Then the kubelet updates the Pod status, the EndpointSlice controller updates the slice within about a second, kube-proxy on each node syncs its rules, typically within a second, and an external load balancer's target registration or health check adds 5 to 30 seconds more. So realistic worst case is 10 to 40 seconds, and during that window requests still arrive. That is why an overload signal through readiness is coarse, and why on shutdown the preStop sleep exists: Spring flips readiness instantly on SIGTERM, but the cluster needs those seconds to notice, and the sleep keeps the socket open meanwhile.

"Where does graceful shutdown fail if the request takes longer than the phase timeout?"

Spring waits up to spring.lifecycle.timeout-per-shutdown-phase, 30 seconds by default, for in-flight requests; after that it proceeds to close the context and the request is cut off, with a connection reset to the client. Then Kubernetes has its own clock: terminationGracePeriodSeconds, also 30 by default, started at the delete, and preStop time counts against it. So a preStop sleep of 10 plus Spring's 30 exceeds the grace period and SIGKILL arrives at second 30 regardless of what Spring is doing. The numbers must nest: grace period greater than preStop sleep plus Spring's phase timeout plus a few seconds for the context to close. For a service with 20-second requests I set preStop 5, Spring 25, grace period 45. Anything longer than that should not be a synchronous request in the first place.

"What does the readiness flip look like with a service mesh in the path?"

The mesh proxy adds a hop that both helps and complicates. Istio's Envoy sidecar watches the same endpoints through the control plane, so it learns of the removal within a second or two of the EndpointSlice change, often faster than a cloud load balancer. But the proxy also holds long-lived connections to the terminating Pod, and unless the application closes them, in-flight and pooled connections keep landing there. On shutdown the sidecar needs to drain its own listeners, and with native sidecars it now terminates after the application, which is the correct order. Istio has a drain duration setting, terminationDrainDuration, which should match the application's drain. In practice the mesh does not remove the need for the preStop sleep; it changes which component's propagation time the sleep is covering.

Q54 · Scenario. "Under peak load, Pods of one service flap between Ready and NotReady every minute, and the flapping makes the remaining Pods hotter. Diagnose and fix."

Reveal answer

Strong answer Diagnosis order: the symptom — readiness failures correlated with load, with a feedback effect — suggests the probe itself is timing out rather than the application choosing to refuse. Evidence: the events show Readiness probe failed: ... context deadline exceeded, meaning the probe's timeoutSeconds (1 second by default) expired; GC logs or the JVM's pause metrics show stop-the-world pauses of one to two seconds at peak; or the actuator endpoint shares the request thread pool and waits in the same queue as user requests. Ranked causes: a 1-second probe timeout that GC pauses or queueing exceed; a readiness endpoint that does real work (a database query per check) and slows under load; a failureThreshold of 1 so a single slow check removes the Pod. The feedback loop: each Pod removed pushes its share to the others, which get slower, which fail their probes. Fix: timeoutSeconds: 3 and failureThreshold: 3 so only sustained failure removes a Pod; serve the actuator on a separate management port (management.server.port) with its own small thread pool so it does not queue behind requests; make the readiness indicator cheap; and if GC pauses are the cause, tune the heap or move to a low-pause collector. Prevention: HPA on request rate so capacity grows before saturation, and a load test that watches probe latency, not just request latency.

Land it A one-second probe timeout is a load-shedding policy nobody chose — give the probe its own port and a tolerance for pauses, and the flapping stops feeding itself.

Likely follow-ups
"You raised the timeout and threshold and the flapping continues. What now?"

Then the probe is not timing out; the endpoint is answering 503 deliberately, and I need to see why. I curl the readiness endpoint from an ephemeral container with the details enabled, management.endpoint.health.show-details=always, and read which indicator is DOWN. Common findings under load: the HikariCP pool is exhausted so the database indicator's validation query waits and fails; a custom indicator checks a downstream over HTTP and that downstream is slow; or the application's own overload logic flips readiness on queue depth with a threshold set too low, so it sheds at 60 percent utilisation and refuses to come back. Each is a different fix: pool size and a cheaper validation, removal of the downstream from readiness, or hysteresis in the overload signal so it flips back only when load drops well below the threshold.

"Why put the actuator on a separate management port, and what is the cost?"

With management.server.port set, Spring starts a second embedded server with its own thread pool, so a probe request never queues behind user requests in Tomcat's pool; a saturated service can still answer "I am alive" and "I am too busy", which is exactly the distinction the probes need. It also keeps the health endpoints off the public port, so they are not reachable through the Ingress. The cost is a second listener with a small pool, a few megabytes and a handful of threads, and one more port in the Service and NetworkPolicy to remember. The probe definitions in the manifest point at the management port, and the mesh, if any, must permit traffic on it from the node's kubelet, which Istio handles by rewriting probes through the sidecar.

"How would you build load shedding that does not cause flapping?"

Shed at the request level first, not the readiness level. A concurrency limiter in front of the request handler, such as a bulkhead with a bounded queue, rejects excess requests with 503 and a Retry-After header in microseconds, while the Pod stays Ready and keeps serving what it can; the gateway retries the rejected request on another replica. Readiness only flips for conditions that will persist for many seconds, and with hysteresis: refuse at 90 percent of capacity for at least 10 seconds, accept again at 60 percent. The HPA on request rate adds Pods before saturation. The combination means the cluster never sees a Pod oscillating: it sees a Pod that is Ready and answering some requests with 503, which the gateway's metrics show as shed load, a signal for the autoscaler and the dashboard rather than a churn of endpoints.

Q55. "A JVM service takes 40–120 seconds to start depending on the node. Configure the probes so it is neither killed early nor left unchecked, and explain why initialDelaySeconds is the wrong tool."

Reveal answer

Strong answer initialDelaySeconds on the liveness probe delays the first check by a fixed amount; to be safe for the slowest start you would set it to 120, which means a Pod that started in 40 seconds is unmonitored for 80 seconds, and a Pod that takes 125 is killed anyway. It is a single number trying to cover a range. The startup probe covers a range by design: periodSeconds: 5 with failureThreshold: 30 gives a budget of 150 seconds, but the moment the probe first succeeds — at 40 seconds on a fast node — the liveness and readiness probes take over immediately. So the configuration is: a startup probe on the liveness path with that 150-second budget; a liveness probe with periodSeconds: 10, failureThreshold: 3, timeoutSeconds: 3, no initial delay; a readiness probe with periodSeconds: 5, failureThreshold: 2, also no initial delay, because the startup probe already gated it. Two details: the startup probe's path should be the liveness path, not readiness, so that a slow dependency during startup does not exhaust the startup budget and trigger a restart; and the budget should be roughly two times the slowest observed start, because a node under pressure or a cold image cache stretches it. If starts are consistently over a minute, that is also a hint to look at Spring's startup itself — lazy initialisation, class data sharing, or AOT compilation.

Land it The startup probe is a budget that ends the moment you are up; initialDelaySeconds is a blindfold you wear for a fixed time regardless.

Likely follow-ups
"What if the startup probe passes, then the application hangs before it serves its first request?"

Then liveness has to catch it, and it will on its own schedule: period 10 with threshold 3 is 30 seconds. The gap is between "the HTTP server answers" and "the application can work", and it appears when the startup probe's path is too shallow. The liveness path in Spring answers as soon as the context is refreshed, which is after all beans are created, so a hang during bean creation keeps the startup probe failing correctly; a hang after that, in a background initialiser, is invisible to liveness by design. The right place for that check is readiness: a readiness indicator that reports DOWN until the initialiser finishes keeps the Pod out of traffic, and minReadySeconds on the Deployment keeps the rollout from advancing on a Pod that flaps. Liveness stays shallow; the deeper checks move to readiness where the failure mode is unrouting, not restarting.

"How would you cut the 120-second start itself?"

Measure first with Spring's startup actuator endpoint or a BufferingApplicationStartup, which shows which beans take the time. Then the usual wins in order: class data sharing with a training run at build time, which typically cuts 20 to 40 percent; Spring Boot's AOT processing, which precomputes the bean definitions and skips reflection at runtime; lazy initialisation for beans not needed to serve traffic; removing classpath scanning of huge packages; and trimming auto-configuration. For a bigger step, CRaC checkpointing restores a warmed JVM from a snapshot in about a second, and a GraalVM native image starts in tens of milliseconds at the cost of build complexity and some library compatibility. The variation between 40 and 120 seconds across nodes is itself a clue: it is usually CPU contention or throttling on the slow nodes, or a cold image cache.

"Does the startup probe budget interact with the rollout's progress deadline?"

Yes. progressDeadlineSeconds, 600 by default, is the time the Deployment controller allows without any progress, and a new Pod only counts as progress when it becomes Available, which requires the startup probe to pass, readiness to pass, and minReadySeconds to elapse. With a startup budget of 150 seconds and a rollout of 10 replicas at maxSurge 1, each Pod has to come up within the deadline window, which it does, since the deadline resets on every progress event. The problem case is a startup budget longer than the deadline, for example a 700-second budget for a service that loads a large model: the Deployment reports ProgressDeadlineExceeded before the first Pod is even allowed to fail, and the pipeline's rollout status exits non-zero on a rollout that is healthy. So the deadline must exceed the startup budget plus minReadySeconds.

Q56 · Design. "Design the health endpoints for a Spring Boot order service that depends on Postgres, Kafka, and a payment provider's API — say exactly what each probe includes and excludes, and why."

Reveal answer

Strong answer Requirements: restarts only when a restart helps, traffic only when a request would succeed, and no check that makes a stressed dependency worse. Design: enable actuator probes (management.endpoint.health.probes.enabled=true) on a separate management port with its own thread pool. The liveness group contains only livenessState — the application context is up and the server thread responds. No database, no Kafka, no HTTP calls; a deadlock detector that flips LivenessState.BROKEN if the request thread pool has been fully blocked for 60 seconds is the only custom indicator I would add. The readiness group contains readinessState plus a cheap Postgres check (HikariCP's pool validation, not a heavy query) because an order service that cannot reach its database cannot serve any request; Kafka is included only if producing is on the synchronous path of an order — if writes go to an outbox table first, Kafka is excluded, because the service can accept orders while Kafka is down. The payment provider is excluded from both: it is external, its slowness is not a reason to stop taking traffic (orders can be accepted and payment retried), and probing it from every replica every five seconds is a self-inflicted load on a partner. Its health shows in the full /actuator/health for humans and in a circuit-breaker metric for alerts. Each indicator has a 2-second timeout so a slow check cannot exceed the probe timeout. What I would not do: point both probes at the default /actuator/health, which aggregates everything and turns any dependency into a restart trigger.

Land it Liveness is "am I alive", readiness is "can I serve an order right now", and an external partner belongs in neither — it belongs in a circuit breaker and a dashboard.

Likely follow-ups
"The requirement changes: Postgres is now behind a read replica for reads and orders are queued to Kafka for writes. What moves between the probes?"

The readiness group changes to reflect what a request needs now. If writes go to Kafka first, Kafka producer health moves into readiness, because an order cannot be accepted when the broker is unreachable; and Postgres becomes two indicators, the primary for the few synchronous writes and the replica for reads. If reads can fall back to the primary when the replica is down, the replica is excluded from readiness and shown only in the full health view. The liveness group does not change at all, since none of this affects whether the process is stuck. The design rule holds: readiness contains exactly the set of dependencies without which every request would fail, and each change to the request path is a change to that set, which is why the health configuration lives next to the code and is reviewed with it.

"What would you cut under time pressure, and what would you refuse to ship without?"

I would cut the custom deadlock detector for liveness and the per-indicator timeouts, and ship liveness as the plain livenessState group and readiness as readinessState plus the database indicator, on the default management port. I would cut the separate management port only if the service is not expected to saturate in its first weeks. I would refuse to ship with both probes on /actuator/health, because that single misconfiguration is the restart storm, and I would refuse to include the payment provider in any probe. Those two refusals take five minutes of configuration and remove the two failure modes that cause total outages; everything else in the design is a refinement that improves behaviour under stress rather than preventing a collapse.

"How do you make sure the indicators cannot be slow themselves?"

Each indicator does a bounded, cheap operation. For Postgres, HikariCP's connection test with connectionTestQuery unset uses JDBC isValid with a timeout, which is a lightweight ping; the health indicator then only needs to borrow a connection with a short pool timeout. For Kafka, checking that the producer's metadata has a reachable broker rather than sending a message. Then I wrap every indicator in a timeout, either by configuring the indicator's own timeout where it exists or by running it through a bounded executor in a custom CompositeHealthContributor, so the endpoint answers within two seconds even if a check hangs. I also cache the readiness result for a second so a burst of probes from several sources, the kubelet and a mesh, does not multiply the load. And I load-test the health endpoint itself, which nobody does until it fails.

"Why not include the payment provider even as a soft signal?"

Because a probe is binary and the provider's state is not a reason to change routing. If every replica has the same view of the provider, marking them all unready during a provider outage takes the order service down entirely, when it could still accept orders, save them, and retry payment asynchronously; and if only some replicas see the provider as down, routing away from them helps nothing since the provider is the same for all. The soft signal belongs in a circuit breaker per replica, which fails fast and retries later, and in a metric that alerts the team. The full /actuator/health, which humans and dashboards read, can include it with a DOWN status mapped to 200 so it never affects a probe. The principle is that probes describe this replica, and a shared external dependency is not a property of this replica.

Q57 · Scenario. "Right after a deploy, all new Pods go CrashLoopBackOff; the old Pods are still serving because maxUnavailable is 0. Give me your diagnosis procedure, in order, and the three most likely causes."

Reveal answer

Strong answer I would diagnose in this order:

  1. Confirm the blast radius. kubectl rollout status shows the rollout stuck; old ReplicaSet still at full count, so users are fine and there is time. Do not roll back blindly yet — the evidence disappears with the Pods.
  2. Read the exit. kubectl describe pod on a crashing Pod: Last State gives the exit code and reason. 137 with OOMKilled is memory; 1 is an application error; 143 is SIGTERM, meaning something killed it — usually a liveness or startup probe failing; 127 or 126 is a broken command or entrypoint in the image.
  3. Read the last words. kubectl logs --previous for the crashed container. A Spring Boot stack trace names the cause: a missing property, a bean that failed to start, a migration that failed, a port already bound.
  4. Ranked causes for a deploy-time crash loop. First, configuration: the new version reads a property or Secret key that does not exist in this environment — the classic "works in staging". Second, resources: the new version's startup footprint exceeds the memory limit, or a new startup task exceeds the startup probe's budget so the kubelet kills it mid-boot (exit 143 with a probe failure event). Third, a schema or dependency mismatch: a Flyway migration failing, a downstream API version the new code needs.
  5. Fix and prevent. Fix the cause and redeploy, or rollout undo once evidence is captured; prevention is a staging environment with production configuration shape, startup-time budgets checked in load tests, and a deploy pipeline that gates on rollout status and auto-reverts after progressDeadlineSeconds.

Land it Exit code, then previous logs, then events — and the answer is nearly always configuration, memory, or a probe budget, in that order.

Likely follow-ups
"kubectl logs --previous shows nothing at all. What does that tell you?"

An empty previous log means the process died before writing anything, which narrows the causes sharply. Either the container's command could not run, in which case the exit code is 127 for command not found or 126 for not executable, and the describe output has a message from the runtime; or the JVM was killed during its first milliseconds, by an OOM kill with a memory limit too small to even start a JVM, exit 137; or logging is not going to stdout, because the new version switched to a file appender, which is itself a common deploy-time regression. I also check the init containers with kubectl logs -c for each, since a failing init container shows the Pod as Init:CrashLoopBackOff and the main container never ran. And I try kubectl debug with a copy of the Pod and a shell as the command, which lets me run the entrypoint by hand and see the error.

"How do you keep evidence if you must roll back immediately?"

Before the undo, capture the state to files: kubectl get pod -o yaml for one crashing Pod, kubectl describe of the same Pod, kubectl logs --previous and the current logs, and kubectl get events sorted by timestamp for the namespace. That takes under a minute. If the failure needs a live Pod to reproduce, I scale the new ReplicaSet to keep one Pod by pausing the rollout with kubectl rollout pause, which freezes the controller, and roll back by scaling the old ReplicaSet manually, or simpler, leave the crash-looping Pods in place since the old Pods are still serving and there is no user impact; the pressure to roll back immediately is lower than it feels when maxUnavailable is zero. The centralised logging pipeline should already have the crash output, which is the reason to ship logs from every container including those that die in seconds.

"Why did staging not catch this, and what would you change in the pipeline?"

Usually because staging differs in exactly the dimension that failed: a Secret key present in staging and missing in production, a smaller memory limit in production, or a production-only integration. So the pipeline changes are about parity and gating. Generate configuration for every environment from the same template so a key cannot exist in one and not another, and run a schema check of the ConfigMap and Secret keys against what the application's configuration classes declare, which Spring's configuration metadata makes possible. Run the staging deploy with the production resource limits. Gate promotion on rollout status of the staging deploy and on a smoke test that exercises startup paths such as migrations. And make the production rollout itself observe its own health with progressDeadlineSeconds and an automatic revert, so the first crash loop is a five-minute event, not a page.

Q58. "Decode exit codes 137, 143, 1, and 0 in a Pod's status, explain the CrashLoopBackOff timing, and say when restartPolicy should not be Always."

Reveal answer

Strong answer Exit codes above 128 mean the process died from a signal: 128 plus the signal number. 137 is SIGKILL (9) — the kernel's OOM killer, or the kubelet after the grace period expired; the Reason field distinguishes OOMKilled from a plain kill. 143 is SIGTERM (15) — the kubelet asked politely, either because of a failed liveness or startup probe, a rollout, or an eviction, and the process exited on the signal; a JVM with a shutdown hook exits 143 on SIGTERM by default. 1 is the application exiting with an error — a Java exception on the main thread, a failed Spring context. 0 is success, which for a long-running server means the process chose to stop, and with restartPolicy: Always the kubelet restarts it anyway and the restart count climbs. CrashLoopBackOff is the kubelet's exponential delay between restarts: 10 seconds, then 20, 40, 80, 160, capped at 5 minutes, reset after the container runs successfully for 10 minutes. The Pod's restartPolicy applies to all its containers: Always for Deployments and StatefulSets, OnFailure or Never for Jobs, where a successful exit must mean done; with Never, a failed Job Pod is left in place for inspection and the Job controller creates a new one, which is the better forensic choice.

Land it 137 means killed, 143 means asked to stop, 1 means the app gave up — and the reason field plus the previous log tells you which of those someone else caused.

Likely follow-ups
"Exit code 143 during a rollout is expected. How do you tell an expected SIGTERM from a probe kill?"

By the events and the timing. A rollout or an eviction produces a Killing event with a message about the container and no probe failure before it, and the Pod has a deletionTimestamp. A probe kill produces a sequence of Liveness probe failed or Startup probe failed events, then Killing with the message "Container app failed liveness probe, will be restarted", and the Pod stays with its restart count incremented rather than being deleted. In the Pod's status, a restart shows in containerStatuses with lastState.terminated and the count, whereas a deletion shows a new Pod with a new name. For the application's own view, Spring logs "Commencing graceful shutdown" on SIGTERM in both cases, so the log alone cannot distinguish them, which is why I always read the events with kubectl get events --field-selector involvedObject.name.

"Can you shorten the five-minute back-off cap, and should you?"

Since 1.33 there is an alpha kubelet feature that lets the node-level maximum back-off be reduced, and a per-node configuration crashLoopBackOff.maxContainerRestartPeriod that can bring the cap down to as low as one second as of Aug 2026, intended for workloads where fast restart matters, such as sidecars or short-lived agents. Whether I should depends on the failure: for a JVM that crashes on startup, a faster restart only burns CPU and floods logs and the registry with pulls, and the five-minute cap is protecting the node. For a transient dependency failure it can help, but the better fix is for the application to retry the dependency rather than crash. I would leave the default and instead make the alert on restart count fire early, so a human looks at the second restart rather than the twentieth.

"Why does restartPolicy apply to the whole Pod, and how do sidecars fit that rule?"

The Pod's restartPolicy is a single field because the Pod is the unit that a controller manages, and mixing policies inside one Pod would leave the controller unable to say whether the Pod as a whole succeeded. Native sidecars are the exception that proves the rule: an init container with its own restartPolicy Always is restarted regardless of the Pod's policy, so a Job with restartPolicy Never can still have a proxy sidecar that recovers from a crash while the main container's failure ends the Pod. There is also a longer-term effort to allow per-container restart policies and restart rules keyed on exit codes, alpha as of Aug 2026, which would let a container say "on exit code 42, restart; otherwise stop". Until then, the pattern is one policy per Pod, chosen by what the main container's exit means.

Drill · Rollouts, termination & disruption

These questions test whether your "zero-downtime deploy" survives the arithmetic of surge and unavailable, and the race between endpoint removal and SIGTERM.

Q59. "A Deployment has 10 replicas and default rollout settings. During a rollout, how many Pods can be serving at the worst moment, how many can exist at the most, and which two other fields decide when the rollout is considered done or failed?"

Reveal answer

Strong answer The defaults are maxSurge: 25% and maxUnavailable: 25%. Surge rounds up: 25 percent of 10 is 2.5, so up to 3 extra Pods, 13 in total. Unavailable rounds down: 2.5 becomes 2, so at the worst moment only 8 of 10 are Ready — a 20 percent capacity dip that happens silently on every deploy. For capacity-sensitive services I set maxUnavailable: 0, so the controller must bring a new Pod to Ready before removing an old one, and maxSurge to whatever headroom the cluster can spare — 25 percent is fine if nodes have room, 1 if they do not. minReadySeconds says how long a new Pod must stay Ready before it counts as available: with 10 seconds, a Pod that passes its readiness probe and then crashes on the first real request does not advance the rollout, which catches a class of bug probes miss. progressDeadlineSeconds, 600 by default, is how long the controller waits for progress before setting the Progressing condition to False with reason ProgressDeadlineExceeded; it does not roll back by itself, but kubectl rollout status exits non-zero, which is what a pipeline should key on to trigger the rollback.

Land it The defaults trade capacity for speed on every deploy — say maxUnavailable 0 out loud, and pair it with minReadySeconds and a pipeline that watches the progress deadline.

Likely follow-ups
"Show the arithmetic for 3 replicas and for 1 replica with the defaults."

With 3 replicas, maxSurge 25 percent rounds up from 0.75 to 1 extra Pod, so at most 4 exist, and maxUnavailable rounds down from 0.75 to 0, so all 3 must stay available; the defaults happen to give zero-downtime behaviour at small counts. With 1 replica, surge rounds up to 1 and unavailable rounds down to 0, so the new Pod is created, must become Ready, and only then is the old one removed, again no downtime, provided the application can run two instances at once. Those small cases mislead people into thinking the defaults are safe: the capacity dip only appears at 4 replicas and above, where 25 percent of 4 is exactly 1 unavailable. The rule is that maxUnavailable rounding down means it is zero below 4 replicas and non-zero after, which is when services usually get their first rollout errors.

"When would you set maxSurge to 0 and maxUnavailable to something positive?"

When the cluster genuinely cannot hold one more Pod of this service: a GPU service where every GPU is taken, a service with a required anti-affinity that has one replica per node and no spare node, or a licence-limited application. Then surge is impossible, and the only way to update is to remove an old Pod first, which costs capacity for the duration of a start. I would pair it with maxUnavailable 1 so the dip is one replica, with a startup that is as short as possible, and with a replica count high enough that one missing replica is acceptable. If the service cannot afford the dip and cannot surge, the answer is more nodes or more GPUs; there is no rollout setting that makes a full cluster deploy for free.

"How does the HPA interact with these numbers during a rollout?"

The rollout's percentages are computed against the Deployment's current replicas, which the HPA may change mid-rollout. If the HPA scales up during a rollout, the Deployment controller distributes the new replicas across the old and new ReplicaSets in proportion, so both grow, and the rollout continues with the larger base. If it scales down, both shrink. That is usually fine, but a scale-down that removes new Pods and keeps old ones stretches the rollout, and a scale-up during a rollout doubles the surge capacity needed. During a rollout new Pods are also cold, so CPU-based HPAs may see high utilisation from warm-up and scale up spuriously, which is another argument for a request-rate metric and for readiness that gates warm-up. Argo Rollouts has explicit handling for this; with plain Deployments I accept it.

Q60 · Scenario. "Every rolling update of a service drops about 2 percent of requests for 10 seconds. maxUnavailable is 0, the app has graceful shutdown enabled. Walk me through finding the cause."

Reveal answer

The real test Whether you know the failures come from the terminating Pod, not the starting one, and can name the race.

Strong answer I would diagnose in this order:

  1. Which side fails? Look at the error type in the gateway or client logs: connection refused and connection reset point at the old Pod being gone before routing caught up; 503 from the new Pod points at readiness passing too early. Correlate the failure window with the Killing event timestamps of the old Pods.
  2. The race. On deletion, endpoint removal (through the EndpointSlice controller, then kube-proxy on every node, then any external load balancer's health check cycle) and SIGTERM to the process start at the same instant. If the process closes its listening socket immediately on SIGTERM — which Spring's graceful shutdown does — then for the one to ten seconds until every node's rules and the load balancer converge, new connections are still sent to it and refused. The 2 percent for 10 seconds matches a load balancer with a 10-second health-check interval.
  3. Ranked causes. No preStop delay, so nothing covers the propagation window. An external load balancer targeting node ports or Pod IPs with a slow health check. Keep-alive connections from clients that are closed abruptly rather than with a graceful Connection: close. And, less often, a terminationGracePeriodSeconds shorter than the drain, so SIGKILL cuts requests mid-flight.
  4. Fix. Add lifecycle.preStop.sleep of 5–15 seconds sized to the slowest propagation path; make sure the grace period exceeds sleep plus the longest request; set the readiness to fail on SIGTERM (Spring does this) so kube-proxy stops routing during the sleep; for external load balancers, use Pod readiness gates so the ALB or NLB's registration state is part of readiness.
  5. Prevention. A load test that runs a rollout under traffic and fails the pipeline on any non-2xx, in staging, on every change to the deployment template.

Land it Graceful shutdown stops taking connections; the cluster keeps sending them for a few seconds — the preStop sleep is the only thing that bridges those two clocks.

Likely follow-ups
"You added a 10-second preStop sleep and the errors dropped but did not vanish. What is the remaining 0.2 percent?"

Two candidates. Keep-alive connections: a client or gateway holding a pooled HTTP connection to the old Pod keeps sending requests on it during the sleep, because the sleep only covers new connections, and when Spring closes the listener the pooled connection is reset mid-request. The fix is for the server to send Connection close on responses once shutdown begins, or for the gateway's connection pool to have a short idle timeout and retry on reset for idempotent methods. The second is the readiness propagation exceeding the sleep on a slow path, such as an external load balancer whose deregistration delay is longer than 10 seconds; the fix is a longer sleep or Pod readiness gates. I would confirm which by looking at whether the failing requests arrived on existing connections or new ones, which the gateway's access log shows through the connection ID or reuse flag.

"What are Pod readiness gates and how do they fix the load balancer case?"

A readiness gate is an extra condition in spec.readinessGates that must be True before the Pod counts as Ready, and it is set by an external controller. The AWS load balancer controller uses this in IP target mode: it registers the new Pod's IP with the target group and only sets the condition once the target's health check passes, so the rollout will not remove an old Pod until the new one is really receiving traffic from the ALB, not just from kube-proxy. On the way out, the controller deregisters the terminating Pod and the ALB drains it for its deregistration delay, which the preStop sleep plus grace period must cover. Without gates, the Deployment thinks the new Pod is serving because the kubelet said so, while the ALB is still health-checking it, so a rollout can briefly have zero healthy targets.

"How do you prove the fix in staging before it reaches production?"

A rollout test under synthetic load. The pipeline deploys to staging, starts a load generator at a realistic rate through the same ingress path as production, triggers a rollout with kubectl rollout restart, waits for completion, and then asserts zero non-2xx responses and no latency spike above a threshold from the load generator's report. I run it on every change to the deployment template, the probe configuration, or the shutdown settings, since those are the inputs to the race. I also run it with a forced node drain of the Pods' node, which exercises eviction rather than rollout and catches PDB and grace period issues. The test takes a few minutes and is the only thing that turns "we have zero-downtime deploys" from a belief into a measured property.

"What does the sleep preStop hook cost, and is there an alternative?"

It costs deploy time: a 10-second sleep per Pod, sequenced by the rollout, adds minutes to a large rollout, and it eats into the grace period. Since 1.30 the sleep action is a first-class lifecycle handler, lifecycle.preStop.sleep with seconds, so it works on distroless images with no shell. The alternative is to remove the race rather than pad it: Spring can be configured to keep accepting connections during graceful shutdown while readiness fails, which is what happens if the application delays closing the listener until it has observed the endpoint removal; some teams implement this as a preStop HTTP call to an endpoint that flips readiness and waits for a configurable time. Either way something waits; the sleep is simply the most transparent version, and its cost is small next to the JVM startup already in the rollout.

Q61. "Walk through the exact termination sequence of a Pod, and explain why an image whose entrypoint is a shell script can make graceful shutdown silently not work."

Reveal answer

Strong answer When the API server receives a delete, it sets deletionTimestamp and the grace period on the Pod. Two things start in parallel. The EndpointSlice controller removes the Pod from Services. The kubelet sees the terminating Pod and, for each container, runs the preStop hook if defined (an exec, an HTTP call, or a sleep) and waits for it; then sends SIGTERM to process ID 1 of the container; then waits until the process exits or the grace period runs out — the grace period clock started at the delete, so preStop time counts against it; then sends SIGKILL. Once every container is gone the kubelet reports it and the API server removes the object. Native sidecars are signalled after the main containers exit. The shell-script trap: if the Dockerfile says ENTRYPOINT ["sh", "-c", "java -jar app.jar"], or a wrapper script runs Java without exec, then PID 1 is the shell, and a shell does not forward SIGTERM to its child by default. The JVM never receives the signal, keeps serving until the grace period ends, and is then SIGKILLed mid-request — graceful shutdown never ran, and nothing logs why. Fixes: use the exec form with the JVM as PID 1, or exec java ... in the script, or a tiny init such as tini that forwards signals and reaps zombies. The Docker appendix covers the same trap from the image side.

Land it SIGTERM is delivered to PID 1 and only PID 1 — if that is a shell, your graceful shutdown is a comment in the manifest.

Likely follow-ups
"How would you detect the shell-as-PID-1 problem in a running cluster, across every image?"

Two checks. On the node side, crictl inspect for each container shows the process, and from a debug Pod I can read /proc/PID/comm for the container's PID 1; anything that says sh or bash is a candidate. Cheaper and fleet-wide: a metric-based signal, because the symptom is a container that always takes the full grace period to stop. The kubelet does not export that directly, but the gap between a Pod's deletionTimestamp and its actual removal, visible in the audit log or through kube-state-metrics' kube_pod_deletion_timestamp, clusters at exactly terminationGracePeriodSeconds for the affected services. The prevention is in the build: a container structure test or a Dockerfile lint in CI that fails on a shell-form ENTRYPOINT or CMD, and a base image standard that uses the exec form with the JVM directly.

"What does tini or dumb-init add beyond signal forwarding?"

Zombie reaping. In Linux, when a process exits, its parent must call wait to collect the exit status; if the parent does not, the process stays as a zombie entry in the process table. PID 1 inherits every orphaned process, and the JVM, like most application runtimes, does not reap children it did not create, so a container whose application spawns subprocesses, such as a PDF converter or a git call, accumulates zombies until the PID limit is hit. tini runs as PID 1, forwards every signal to its single child, reaps zombies, and exits with the child's code. It is a few hundred kilobytes, and Docker's --init flag adds it automatically outside Kubernetes. With shareProcessNamespace, the pause container takes over reaping, which is the other way to get it.

"What happens if preStop itself hangs?"

The kubelet waits for the preStop handler, but only until the grace period expires; the grace clock started at the delete, so a hung preStop consumes the whole period, SIGTERM is sent with whatever is left, which may be nothing, and SIGKILL follows immediately. A FailedPreStopHook event is recorded. So a preStop that calls an HTTP endpoint on a wedged application or runs a script that waits on a lock is a way to turn graceful shutdown into an instant kill. The mitigations are a sleep action rather than a script where a sleep is all that is needed, a timeout inside any exec hook, and a grace period long enough that the hook's worst case plus the application's drain still fit. I also watch for the case where a preStop hook depends on a sidecar that has already been told to stop, which native sidecars fix by ordering.

"How does terminationGracePeriodSeconds interact with a node drain and with a spot interruption?"

A drain uses the eviction API, which deletes Pods with their normal grace period, so a fleet of Pods with a 45-second grace period makes a drain of a busy node take at least that long per batch; a drain of 50 nodes for an upgrade is bounded by grace periods times Pods per node divided by concurrency. kubectl drain has --grace-period to override downward, which I avoid because it defeats the shutdown. A spot interruption is a two-minute deadline, so the sum of drain overhead and the longest grace period on the node must fit inside 120 seconds or the last Pods are killed mid-request when the instance disappears. Karpenter respects the Pod's grace period and has a terminationGracePeriod on the NodePool that caps the whole node's drain, which is the right place to align the two clocks.

Q62 · Scenario. "A team switched a service to strategy Recreate to 'avoid version-mixing bugs'. Now every deploy is a 90-second outage. What should they have done, and when is Recreate actually right?"

Reveal answer

Strong answer Diagnosis order: Recreate scales the old ReplicaSet to zero and only then creates the new one, so the outage is exactly the JVM's startup time plus the startup probe — 90 seconds is the expected cost, not a bug. The evidence is the rollout events: scale-down to 0 followed by scale-up. The team's real problem was that two versions of the service were live at once during a rolling update, and something was not compatible across versions: a database schema change that the old version could not read, a serialised session or cache format, or an API response the old front-end could not parse. The right fix is to make versions compatible for the duration of a rollout, which is the backward-compatible migration discipline: expand the schema first (add the column, keep the old one), deploy code that handles both, then contract in a later release — the pattern described in E8 and E7. With that discipline, RollingUpdate with maxUnavailable: 0 gives zero downtime and version mixing is harmless. Recreate is right in a narrow set of cases: a single-replica workload with a ReadWriteOnce volume that only one Pod can mount, so the old one must release the disk before the new one starts; a legacy application that genuinely cannot run two instances (a file lock, a non-idempotent scheduler); or a dev environment where downtime is free. For everything else, Recreate is a confession that the migration process is missing.

Land it Recreate trades an outage for skipping compatibility work — the expand-and-contract discipline removes the need for the trade.

Likely follow-ups
"Give a concrete version-mixing bug and the expand-and-contract steps that avoid it."

Say the new version renames the column customer_ref to customer_id. A rolling update runs both versions, and whichever version's migration ran, the other version's queries fail. Expand-and-contract in three releases: release one adds customer_id alongside customer_ref, with a trigger or dual-write in the code so both columns stay in sync, and the code reads customer_ref; release two reads customer_id and still writes both, with a backfill job for old rows; release three drops customer_ref and the dual-write. Each release runs fine next to its predecessor, so every rollout and every rollback within one step is safe. The same discipline applies to serialised caches with a version field, event schemas with additive changes only, and API responses that only add fields. The cost is three deploys instead of one, and the return is never needing Recreate.

"The single-replica ReadWriteOnce case: is there any way to avoid the outage?"

Partly. The disk is the constraint: only one node can mount it, and the old Pod must unmount before the new one mounts, so a true overlap is impossible with that disk. What can be shortened is everything else: a startup that is fast, a readiness probe that passes quickly, and the detach and attach time, which on cloud disks is often 20 to 40 seconds and is the largest part of the 90. Moving the state to a ReadWriteMany filesystem such as NFS or EFS allows two Pods and a rolling update, at the cost of file locking semantics the application must tolerate. Or move the state out entirely to a managed database or object storage, which is the real fix for anything that matters. If none of those is possible, schedule the deploy in a low-traffic window and make the outage explicit in the runbook.

"How do you convince the team, given they had a real bug and Recreate did stop it?"

By separating the symptom from the cost. I would show the deploy frequency times 90 seconds as monthly minutes of outage, and the incident count before Recreate, which was probably one. Then I would demonstrate that the bug was a migration ordering problem with a specific fix, and pair with them on the expand step for the next schema change so the discipline is learned rather than imposed. I would keep Recreate for one more release while the compatibility tests are added, then switch back to RollingUpdate with maxUnavailable 0 and run the rollout-under-load test in staging, so the team sees zero errors before production. The argument that lands is usually that Recreate also makes rollback an outage, so the strategy meant to reduce risk doubled the cost of every mistake.

Q63 · Design. "Design zero-downtime deploys for a Spring Boot service on Kubernetes end to end: manifest, application, image, and pipeline."

Reveal answer

Strong answer Requirements: no failed requests during a rollout, a rollback path that is as safe as the rollout, and capacity never below the replica count. Manifest: RollingUpdate with maxUnavailable: 0 and maxSurge: 25%; minReadySeconds: 10; a startup probe with a budget of twice the slowest start; readiness on /actuator/health/readiness; liveness on the liveness path only; preStop sleep of 5 seconds (longer if an external load balancer is in the path); terminationGracePeriodSeconds: 45; memory request equal to limit, CPU request without limit; a PDB with maxUnavailable: 1; topology spread across zones; and at least two replicas. Application: server.shutdown=graceful with a 30-second phase timeout; a readiness indicator that includes the database; the actuator on a separate management port; backward-compatible schema migrations run as an init container or a Job gated in the pipeline before the rollout, following expand-and-contract; idempotent handlers so client retries during the switch are safe. Image: the JVM as PID 1 through the exec-form entrypoint; a non-root distroless base; a digest-pinned tag. Pipeline: GitOps commit of the new tag; the agent applies; the pipeline waits on kubectl rollout status --timeout and on a synthetic check hitting the public route; on failure it reverts the Git commit, which the agent applies as a normal rollout in reverse. For high-risk changes, a canary through Gateway API weights or Argo Rollouts with an automated analysis on error rate. What I would not do: rely on rollout undo as the rollback in a GitOps world, run schema migrations inside the application's startup on every replica, or promise zero downtime for a single-replica service with a ReadWriteOnce volume.

Land it Zero downtime is four contracts kept at once — rollout arithmetic, probe honesty, the termination timeline, and compatible migrations — and a pipeline that refuses to declare victory until the route itself answers.

Likely follow-ups
"The requirement changes: the service also consumes from Kafka. What does zero downtime mean for the consumer side?"

For a consumer, the risk is not failed HTTP requests but rebalances and duplicate processing. When a Pod stops, its partitions are reassigned, and until the new Pod joins, those partitions are not consumed; a rolling update of ten Pods can cause ten rebalances, each pausing the whole group for seconds. The manifest side is the same, but the application side adds: cooperative sticky assignment, so a rebalance moves only the affected partitions; a graceful shutdown that commits offsets and leaves the group cleanly on SIGTERM, which Spring Kafka does when the listener container is stopped; static group membership with group.instance.id tied to the Pod's ordinal if the consumer is a StatefulSet, so a restart within session.timeout.ms does not trigger a rebalance at all; and idempotent handlers, since at-least-once delivery is the contract. Lag during the rollout is expected and should be graphed, not alerted on.

"What would you cut if you had one day?"

I would ship the manifest contract in full, since it is a few lines: maxUnavailable 0, the three probes with the split paths, preStop sleep 5, grace period 45, memory request equal to limit. On the application side I would set server.shutdown graceful and the actuator probes, which is two properties. I would cut the separate management port, the PDB, the canary tooling, and the synthetic check in the pipeline, keeping only rollout status with a timeout. On the image I would verify the exec-form entrypoint, which takes a minute to check and is the difference between graceful shutdown existing or not. Migrations I would leave as they are for a day but with a rule that no incompatible migration ships until the Job-based path exists. That gets to zero errors on a normal deploy; the cuts are about resilience under abnormal ones.

"Why run migrations as a separate Job rather than on application startup?"

Because on startup every replica runs the migration concurrently. Flyway takes a lock so only one actually applies the change, but the others wait on that lock during startup, which stretches the startup probe budget and, if the migration is long, expires it and restarts the Pods in the middle of a migration. A failed migration then crash-loops the whole rollout with no old Pods affected, which is safe but confusing. A separate Job, run by the pipeline before the rollout with rollout gated on its success, runs once, has its own timeout and logs, can be retried independently, and makes the expand step explicit. The application still validates on startup that the schema version is at least what it needs, and refuses to start otherwise, so a rollout that skipped the Job fails loudly rather than corrupting data.

"How does the pipeline decide that the deploy succeeded, exactly?"

Three gates in order. First kubectl rollout status deployment/orders --timeout=10m, which returns non-zero if the Progressing condition goes False or the timeout expires, and only zero when every replica is on the new template and Available. Second, a synthetic probe against the public route, not the Service, since the route exercises the ingress, TLS, and any external load balancer registration; it runs a handful of real requests including a write on a test tenant. Third, a short soak: the pipeline reads the error rate and p99 for the new version from the metrics backend over five minutes and compares them with the previous version's baseline. Only after all three does it mark the release as promoted and tag the commit. If any gate fails, it reverts the Git commit, which the GitOps agent applies, and posts the failing gate's output to the team's channel.

Q64 · Scenario. "A rollout has been sitting at '2 of 3 updated replicas available' for an hour. No Pods are crashing. Users are fine. What is going on and what do you check?"

Reveal answer

Strong answer Diagnosis order: two new Pods reached Ready and the third is not counting, without crashes, so the third new Pod is either not scheduled, not Ready, or the controller is blocked by constraints. Evidence: kubectl get pods with the new template hash; rollout status; kubectl describe deploy for the conditions — Progressing: False, ProgressDeadlineExceeded after ten minutes. Ranked causes. One: the third new Pod is Pending because with maxSurge: 1 and maxUnavailable: 0 the cluster had room for one extra Pod but the spread constraint requires a zone where no node has capacity — the Pod's FailedScheduling event says so. Two: the third new Pod is Running but never Ready — its readiness probe fails on this particular node or zone (a NetworkPolicy, a zone-local dependency) while the first two happened to pass, or a minReadySeconds that is never satisfied because the Pod is Ready but keeps flapping. Three: the old Pods cannot be terminated because a PDB with minAvailable: 3 blocks the controller from scaling the old ReplicaSet down — though a Deployment rollout does not go through the eviction API, so this is rarer than people think; more often it is the autoscaler having scaled up the desired count mid-rollout. Fix per cause; the general move is to read the one Pod that differs. Prevention: alert on ProgressDeadlineExceeded, and keep surge capacity available in every zone the spread constraint names.

Land it A rollout stuck at N-of-M with no crashes is one Pod that is Pending or unready — find the one that differs, and the Deployment's Progressing condition tells you how long it has been so.

Likely follow-ups
"The third Pod is Running and Ready but the Deployment still says 2 available. How?"

Available is not the same as Ready. A Pod becomes available only after it has been Ready continuously for minReadySeconds, so if the Pod's readiness flaps even once inside that window, the clock restarts and it never counts. kubectl get pod shows Ready 1/1 at any given moment while kubectl describe shows the readiness condition's lastTransitionTime moving. The other possibility is a very high minReadySeconds set by mistake, such as 3600 instead of 60. I would watch the Pod's Ready condition for a few minutes, and read the readiness probe's failure events; a probe that fails once a minute under this Pod's particular load or node is the cause, and the fix is the probe's timeout or the endpoint's cost rather than anything in the rollout.

"Can a PDB block a Deployment rollout at all?"

Not directly. The Deployment controller scales the old ReplicaSet down, and the ReplicaSet controller deletes Pods with an ordinary delete, which bypasses the eviction API and therefore ignores PDBs. The confusion comes from two places. Argo Rollouts and some canary controllers check PDBs before proceeding, so with those tools a tight budget does pause a rollout. And a rollout mid-way through a node drain interacts: the drain's evictions are blocked by the PDB while the rollout has reduced the Ready count, so the drain stalls, not the rollout, and the two together look like a stuck deploy. The rule to say aloud is that PDBs govern evictions, and Deployments do not evict, so a rollout that will not finish has a scheduling or readiness cause, never a budget.

"How would you build an alert for this that does not fire on every slow deploy?"

On the condition rather than on the replica counts. kube-state-metrics exports kube_deployment_status_condition with condition Progressing and status false, which the Deployment controller sets only after progressDeadlineSeconds without progress, ten minutes by default; alerting on that being true for more than one minute fires once per genuinely stuck rollout and never on a healthy slow one. I would add the reason label, ProgressDeadlineExceeded, and route it to the owning team. A second, softer signal is kube_deployment_spec_replicas minus kube_deployment_status_replicas_available being non-zero for longer than the service's expected rollout time, useful for rollouts that are progressing but far slower than they should be. I would not alert on updated replicas versus desired, because that is non-zero for the entire duration of every normal rollout.

Q65 · Design. "Blue-green or canary for a payments service — design the one you would choose on Kubernetes, with the objects involved, and explain what the other one would have cost you."

Reveal answer

Strong answer Requirements for payments: bugs must reach as few transactions as possible, rollback must be instant, and version mixing must be safe because both strategies mix versions at the database. I would choose canary. Design: two Deployments, payments and payments-canary, sharing the same ConfigMaps but with separate Services; an HTTPRoute whose backendRefs carry weights — 99 and 1 to start; a promotion pipeline that raises the weight in steps (1, 5, 25, 50, 100) while an analysis job compares error rate and p99 latency between the two backends over a five-minute window at each step, reverting the weight to zero if the canary is worse by a threshold. Argo Rollouts packages this as a Rollout object with an AnalysisTemplate querying Prometheus and a traffic-routing plugin for the Gateway API, so the two Deployments and the weight math are managed for me. Header-based routing sends internal testers to the canary before any real traffic. Trade-offs: canary needs metrics good enough to judge a 1 percent slice, sticky sessions must be considered, and the two versions coexist for longer, so schema compatibility is mandatory. Blue-green — two full Deployments with the route flipped from one Service to the other — gives an instant, total switch and instant rollback, but costs double capacity for the whole window, and exposes 100 percent of transactions to the new version at once; for payments that is the wrong direction of risk. Blue-green is right when the change cannot be partially exposed — a protocol change, or a stateful system where two versions really cannot share — and for those I would use it with a full pre-production soak. What I would not do: canary by scaling replicas of two Deployments behind one Service, because traffic splits by Pod count, cannot go below one Pod's share, and cannot be reversed without terminating Pods.

Land it Canary by route weight limits the blast radius to a percentage you choose; blue-green limits the duration but not the radius — for money, choose the radius.

Likely follow-ups
"The requirement changes: the payments service is stateful per session, with sticky sessions. Does canary still work?"

It works with care. Weighted routing with a per-request split would bounce a user between versions, which breaks any session-local state. The fix is consistent assignment: the Gateway API's session persistence, or the mesh's consistent-hash load balancing on a cookie or a header, so that a user who lands on the canary stays on the canary for the session. Then the canary weight means the fraction of new sessions rather than of requests, and the analysis window has to be longer, since sessions are sticky and the error rate converges slowly. Rollback also changes: setting the weight to zero stops new sessions but existing ones drain at their own pace, which for a bad version means waiting or forcing them by terminating the canary Pods, which is a session loss for those users. The better long-term move is to make sessions external, in Redis, so routing can be stateless again.

"What would you cut under time pressure and still call it a canary?"

I would cut Argo Rollouts and the automated analysis, and do a manual canary: two Deployments behind an HTTPRoute with weights, a runbook that says set the weight to 5 percent, watch a specific dashboard for 15 minutes, then go to 50 and 100, with a one-command revert that sets the weight to zero. That is a couple of manifests and a dashboard. I would keep the header-based routing for internal testers, because it costs a single HTTPRoute rule and catches the obvious bugs before any customer sees them. I would cut the business-metric comparison and judge on error rate and latency only. What I would not cut is the two-Deployment structure with separate Services, because canary by replica count behind one Service cannot be reversed instantly and cannot go below one Pod's share.

"What happens to the database during a blue-green switch, and how is that different from canary?"

The switch itself is instant, but the database saw the green version's migration before the switch, and blue must keep working against the migrated schema until you decide not to roll back, so the compatibility rules are the same as canary's, only with a shorter coexistence. The difference is in the data written during the window: with blue-green, once switched, all writes come from green; if you switch back, blue must be able to read everything green wrote, which is the backward-compatibility half of expand-and-contract. With canary, both versions write simultaneously for a longer time, so both directions of compatibility are exercised continuously. Neither strategy can roll back a schema change, and both need the contract step to wait until the old version is gone for good. Blue-green tempts people to think the database can be switched too; it cannot.

"How do you compare the canary fairly when it has one Pod and the stable has twenty?"

By comparing rates, not counts, and by accounting for warm-up and noise. The metrics are per backend from the gateway, so error rate is errors divided by requests for each; with 1 percent weight the canary gets a hundredth of the traffic, and at 500 requests per second overall that is five per second, enough for error rates but too few for a stable p99, so the first step judges on errors and p50 and the p99 comparison waits until 10 percent. The canary is one cold JVM, so I exclude the first two minutes and use a warm-up period in the analysis. And I compare against the stable version's rate over the same window, not against an absolute threshold, so a platform-wide slowdown does not fail the canary. Argo Rollouts' AnalysisTemplate expresses all this with a PromQL query, an initialDelay, a count of measurements, and a failureLimit.

Q66 · Design. "Design the automatic rollback mechanism for the canary you just described — what signals, what thresholds, what it must never do."

Reveal answer

Strong answer Requirements: detect a bad version within minutes at a 1–5 percent exposure, avoid false rollbacks from noise, and never leave traffic pointed at nothing. Signals, from the gateway's metrics so both versions are measured identically: HTTP 5xx rate per backend, p99 latency per backend, and a business signal — payment authorisation success rate — from the application's own metrics labelled by version. Thresholds are relative, not absolute: the canary's error rate may not exceed the stable version's by more than 0.5 percentage points and its p99 by more than 20 percent over a five-minute window, with a minimum request count (say 500) before any judgement is made so a quiet minute cannot trigger anything. Each promotion step requires two consecutive passing windows. On failure: set the canary weight to zero (never delete the canary Deployment immediately, so its logs and Pods remain for diagnosis), mark the rollout as aborted, page the owning team, and open a ticket with the analysis output attached. Guard rails: the analysis must fail closed if the metrics query itself errors — no data is not a pass; a manual "hold" step before 50 percent for anything touching money; and a hard limit that the mechanism only ever changes route weights, never scales the stable Deployment, so the worst case of a bug in the rollback tool is a canary at zero and a stable service untouched. It must never roll back the database migration — schema changes are forward-only and compatible, which is what makes the code rollback safe. What I would not do: judge on CPU, roll back on a single window, or let the rollback delete the evidence.

Land it Compare the canary to the stable version over enough requests, fail closed on missing data, and let the tool touch only the route weight — the stable path is sacred.

Likely follow-ups
"The rollback fired but the errors continue on the stable version. What happened?"

Then the canary was not the cause, or it was and its damage persists. First I confirm the weight really went to zero and the gateway applied it, by reading the HTTPRoute status and the gateway's per-backend request counts; a stale route or a cached DNS entry can keep traffic flowing to the canary. If the canary truly gets nothing, the errors are either platform-wide, a database or a downstream, coinciding with the canary by chance, or a side effect the canary left behind: a migration it ran, bad data it wrote, a cache it poisoned, or a feature flag it flipped in a shared store. That is why the rollback mechanism must never touch shared state and why the canary should not run migrations. The next step is an ordinary incident: what changed, including the canary's writes, and the dashboards for the dependencies rather than the versions.

"How do you stop the mechanism itself from causing an outage?"

By limiting what it can do and testing it as production code. Its permissions are a Role that can update HTTPRoute weights and the Rollout object in one namespace and nothing else; it cannot delete Deployments, scale, or touch ConfigMaps. Its actions are idempotent and bounded: set a weight to a value in a fixed ladder, never compute one. It fails closed on missing data but also fails safe on its own errors: if the analysis tool crashes, the rollout pauses at its current weight and pages, rather than either promoting or reverting. The rollback path is exercised deliberately in staging every week by deploying a version that returns 500s, so the mechanism's own regressions are caught. And there is a manual override, a single kubectl argo rollouts abort, documented, so a human can take over without fighting the automation.

"Why relative thresholds rather than an absolute error budget?"

Because an absolute threshold is either too tight or too loose depending on the day. If the stable version runs at 0.3 percent errors because of a flaky downstream, an absolute limit of 0.5 percent fails a perfectly good canary during any downstream wobble, and a limit of 2 percent lets a canary that doubled the error rate through. Comparing the canary to the stable version over the same window cancels out everything they share, the downstream, the database, the traffic mix, and isolates the effect of the version. I still keep one absolute guard, a hard ceiling such as 5 percent errors on the canary regardless of the stable's rate, so that a day where both are bad cannot promote a canary. And the minimum request count exists because a ratio over ten requests is noise.

Q67 · Scenario. "An engineer ran kubectl rollout undo during an incident. Three minutes later the bad version was back. Explain, and say what the correct rollback procedure is in this environment."

Reveal answer

Strong answer Diagnosis order: the bad version returning on its own, after a few minutes, is the signature of a GitOps agent with self-healing enabled — Argo CD's selfHeal or Flux's reconciliation interval, both typically around three minutes. The undo changed the live Deployment's template back to the old image; the agent compared live state with Git, saw drift, and re-applied the manifest from Git, which still named the bad image. Evidence: the Argo CD application history shows a sync with "OutOfSync" then "Synced" at the moment of the reversion, and the Deployment's revision history shows three rollouts. The correct procedure: revert the commit that changed the image tag in the environment repository, which the agent applies as a normal rollout within its interval; if three minutes is too slow during an incident, pause the agent's auto-sync for that application first, then rollout undo for the immediate effect, then revert in Git, then resume sync — in that order, so that the moment sync resumes, Git and the cluster agree. Prevention: a documented incident runbook with the exact commands, a one-click "revert last deploy" job in the pipeline that does the Git revert, and the platform team making the sync status visible on the same dashboard where people watch the rollout.

Land it Under GitOps, the cluster is a cache of Git — undo the cache and Git refills it, so the rollback is a revert, and the manual undo is at most a bridge while the revert lands.

Likely follow-ups
"How exactly do you pause Argo CD's auto-sync for one application, and what does it not stop?"

Either argocd app set orders-prod --sync-policy none, which removes automated sync, or, less disruptively, argocd app set with --self-heal false if I want automation to stay but drift to be tolerated. In the UI it is the same toggle on the application. This stops Argo from applying Git to the cluster for that application. It does not stop other writers: the HPA still scales, the VPA still evicts, and a second Argo application or a Flux Kustomization that overlaps the same objects still syncs, which is a real trap in installations that grew organically. It also does not stop the Deployment controller from continuing whatever rollout was in flight, so if my undo raced with an ongoing rollout, I check rollout status before assuming the cluster is quiet.

"What is the fastest safe rollback if the Git revert takes ten minutes to get through review?"

Reviews should not stand in the way of a revert, and the fix is a pre-approved path: a pipeline job that reverts the last image-tag commit on the environment branch with a bot identity, protected by branch rules that allow that bot to bypass review for reverts only, and posts the diff to the channel. That takes under a minute. If that does not exist yet, then in order: pause sync, rollout undo, and open the revert with the incident ticket linked so review is a formality; the cluster is already on the old version, and the revert only makes Git agree. The rule I would write afterwards is that any environment repository must have a revert path that is faster than the GitOps sync interval, because otherwise every incident includes this argument.

"Why did the agent re-apply within three minutes and not instantly?"

Argo CD polls Git every three minutes by default, timeout.reconciliation, and separately watches the cluster for drift; with selfHeal enabled it re-syncs when live state differs from the last-synced manifests, which is triggered by the cluster watch and can be faster than three minutes, throttled by a self-heal back-off of a few seconds. So the three minutes in the scenario was probably a poll cycle, and with a webhook from Git it would have been seconds after any commit, while self-heal alone would have caught the undo within a minute or two. The precise timing depends on the installation's settings, which is why I would read the application's sync history, where each sync records what triggered it and the revision it applied, rather than guess.

Q68. "Explain PodDisruptionBudget semantics precisely: what it protects against, what it does not, how percentages round, and what unhealthyPodEvictionPolicy changed."

Reveal answer

Strong answer A PDB constrains the eviction API — the path used by kubectl drain, the cluster autoscaler, the descheduler, and preemption's best-effort check. An eviction is allowed only if, afterwards, at least minAvailable Pods matching the selector remain Ready, or at most maxUnavailable are missing. It protects against voluntary disruption: node upgrades, scale-in, rebalancing. It does not protect against a node crash, an OOM kill, a liveness restart, or a plain kubectl delete pod, which bypass eviction entirely; nor does it slow a Deployment's own rollout, which scales ReplicaSets directly. Percentages: minAvailable: 50% of 3 rounds up to 2 required; maxUnavailable: 50% of 3 rounds down to 1 allowed — both err on the side of availability. A PDB with maxUnavailable: 0, or minAvailable equal to the replica count, blocks every eviction and will stall a node upgrade indefinitely. Before 1.27, a Pod that was already unhealthy still counted as "would become unavailable", so a crash-looping Deployment could block a drain forever; unhealthyPodEvictionPolicy: AlwaysAllow, stable since 1.27, lets not-Ready Pods be evicted freely, since removing them cannot reduce availability — and it should be the default in every base chart.

Going deeper One version correction: unhealthyPodEvictionPolicy arrived as beta and enabled by default in 1.27 and became stable in 1.31, so "available since 1.27, GA in 1.31" is the accurate statement as of Aug 2026. Two mechanisms worth having ready. First, the eviction API is a POST to pods/<name>/eviction; the API server checks every PDB whose selector matches the Pod, computes status.disruptionsAllowed, and returns 429 Too Many Requests when it is zero, which is why a drain loop retries rather than fails. The PDB controller keeps that count in status and it is exactly what kubectl get pdb shows under ALLOWED DISRUPTIONS. Second, the PDB needs to know the expected total: for Pods owned by a Deployment, ReplicaSet, StatefulSet, or a custom resource with a scale subresource, it reads the owner's replica count; for Pods with no such owner, a percentage-based PDB cannot be computed and the PDB reports a condition, so bare Pods or unusual controllers must use absolute numbers. To verify a PDB is doing what you think, run kubectl drain --dry-run=server against a node, or issue one eviction by hand with kubectl create -f an Eviction object and read the response.

Going deeper One version correction: unhealthyPodEvictionPolicy arrived as beta and enabled by default in 1.27 and became stable in 1.31, so "available since 1.27, GA in 1.31" is the accurate statement as of Aug 2026. Two mechanisms worth having ready. First, the eviction API is a POST to pods/<name>/eviction; the API server checks every PDB whose selector matches the Pod, computes status.disruptionsAllowed, and returns 429 Too Many Requests when it is zero, which is why a drain loop retries rather than fails. The PDB controller keeps that count in status and it is exactly what kubectl get pdb shows under ALLOWED DISRUPTIONS. Second, the PDB needs to know the expected total: for Pods owned by a Deployment, ReplicaSet, StatefulSet, or a custom resource with a scale subresource, it reads the owner's replica count; for Pods with no such owner, a percentage-based PDB cannot be computed and the PDB reports a condition, so bare Pods or unusual controllers must use absolute numbers. To verify a PDB is doing what you think, run kubectl drain --dry-run=server against a node, or issue one eviction by hand with kubectl create -f an Eviction object and read the response.

Land it A PDB is a promise to the drain, not to the universe — write it as maxUnavailable 1 with AlwaysAllow, and it protects you without holding the cluster hostage.

Likely follow-ups
"What happens when two PDBs match the same Pod?"

The eviction API rejects the eviction outright with an error rather than picking one, because it cannot decide which budget applies. The Pod becomes undrainable until the overlap is removed. It is an easy mistake in a namespace where a platform chart adds a default PDB with a broad selector such as app.kubernetes.io/part-of, and a team adds their own with app. The check is kubectl get pdb -A with their selectors, and a quick script that, for each Pod, counts matching PDBs. The platform rule is one PDB per workload, generated by the same chart as the Deployment with the same selector, and an admission policy that rejects a PDB whose selector overlaps an existing one in the namespace, which is possible in CEL by comparing against a parameter list.

"How should the PDB be written for a service with an HPA whose minReplicas is 2?"

maxUnavailable 1, not minAvailable. With minAvailable 2 and the HPA at its minimum of 2, allowed disruptions is zero and every drain stalls until the HPA happens to scale up. maxUnavailable 1 always allows exactly one eviction at a time regardless of the current count, so a drain proceeds one Pod at a time and the service is never below replicas minus one. For percentage forms, maxUnavailable 25 percent rounds down, so at two replicas it rounds to zero and blocks; hence the absolute 1. Combine it with a topology spread across nodes so that a single node drain evicts one replica, not both, and with unhealthyPodEvictionPolicy AlwaysAllow so a crash-looping replica does not hold the budget. For a single-replica service, the honest PDB is none, or maxUnavailable 1, which is the same thing.

"Does the cluster autoscaler respect PDBs, and what does that mean for scale-down?"

Yes, it evicts through the eviction API, so it will not remove a node if doing so would violate a PDB, and it also refuses to remove nodes running Pods that have no controller, that use local storage, or that carry the annotation cluster-autoscaler.kubernetes.io/safe-to-evict false. The consequence is that a tight PDB, or a PDB that is never satisfiable, silently prevents scale-down: the cluster stays large and the bill stays high with no error anywhere except the autoscaler's log, which lists each node's blocking reason. Karpenter behaves the same with its consolidation. So a PDB review is part of cost work: the autoscaler's status ConfigMap and the metric cluster_autoscaler_unremovable_nodes_count with its reason label tell me how many nodes are stuck and why, and a PDB that blocks is one of the top reasons.

Q69 · Scenario. "A managed cluster upgrade has been stuck for six hours on the third node. The cloud console just says 'draining'. Find the cause and unblock it without dropping traffic."

Reveal answer

Strong answer Diagnosis order: a drain that never finishes is an eviction being refused, repeatedly. Evidence: kubectl get pods --field-selector spec.nodeName=<node> lists what remains; the drain's events or the upgrade log show Cannot evict pod as it would violate the pod's disruption budget; kubectl get pdb -A shows the budget with ALLOWED DISRUPTIONS 0. Ranked causes. One: a PDB that can never allow an eviction — minAvailable equal to replicas, or a single-replica Deployment with maxUnavailable: 0. Two: a PDB that could allow one but the workload is unhealthy — a replica is not Ready elsewhere, or the Pod on this node is itself crash-looping and the policy is the old IfHealthyBudget default. Three: the replacement Pods cannot schedule on the remaining nodes (capacity, or the new node pool has a different taint), so the Deployment never returns to full health and the PDB keeps saying no. Four: a Pod with an unmanaged owner or a local-storage volume that drain refuses without --delete-emptydir-data. Unblock without dropping traffic: fix the workload's health first (the PDB then allows one); scale the Deployment up by one so the budget has slack, let the drain evict, scale back; or, for the unsatisfiable PDB, edit it to maxUnavailable: 1 — never delete it during the drain, because the drain then proceeds with no protection at all. Prevention: an admission policy rejecting PDBs that allow zero disruptions for the replica count, AlwaysAllow everywhere, a pre-upgrade check that every PDB currently has allowed disruptions above zero, and capacity headroom in the pool for one node's worth of Pods.

Land it The upgrade is stuck because a budget is honestly refusing, and the right unblock is to give the budget slack — by healing or scaling the workload — not to take the budget away.

Likely follow-ups
"You scaled the Deployment up by one and the drain still refuses. Why?"

Because the extra replica did not become Ready, or the budget is not the one I thought. If the new replica is Pending, the remaining nodes have no room, which is the third cause, and the fix is capacity, either a temporary node or right-sizing. If it is Running but not Ready, its readiness depends on something on the drained node, such as a zone-local dependency, or the probe is failing for its own reasons. If it is Ready and the PDB still shows zero allowed, then a second PDB matches these Pods, or the PDB I scaled for is on a different workload; kubectl get pdb -o yaml shows currentHealthy, desiredHealthy, and expectedPods, and comparing those three numbers with the Pods I can see says which of these it is. The eviction error message names the PDB, which is the fastest way to be sure.

"The managed upgrade has a timeout. What happens when it expires, and how do you prepare for that?"

Providers differ. GKE's node upgrade respects PDBs for up to an hour per node and then forcibly evicts, so the outcome is the eviction the PDB was blocking, only later and without warning. EKS managed node groups fail the upgrade after a while and leave the group in a degraded state with a mix of versions, which needs manual resumption, and they have a force option that ignores PDBs. AKS behaves similarly to GKE with its drain timeout. So the preparation is to know your provider's behaviour, to run the pre-upgrade PDB check that every budget has allowed disruptions above zero, and to schedule upgrades when on-call can respond within the timeout. I also set a maintenance window and surge settings on the node pool so that a new node exists before each old one drains.

"How would you make node upgrades routine rather than an incident?"

By running them often and making them boring. A monthly cadence for node image updates and a quarterly one for minor versions keeps each step small. Every workload gets a PDB from the platform chart with maxUnavailable 1 and AlwaysAllow, a spread across nodes, and a tested graceful shutdown, so a drain is a non-event. The pool has surge capacity configured so a new node is up before the old one drains, and headroom for one node's worth of Pods. An admission policy rejects PDBs that would allow zero disruptions. Before each upgrade, a script drains one canary node and checks that every Pod rescheduled and became Ready within five minutes, which catches the stuck-PDB case on one node rather than the third of fifty. And the upgrade runs in staging a week ahead on the same manifests.

Q70 · Design. "A ConfigMap change is not picked up by running Pods. Design the platform's standard for delivering configuration changes to a Spring Boot fleet — restart-based and live — and say which changes may never be live."

Reveal answer

Strong answer Requirements: configuration changes reach Pods predictably, are auditable, and cannot leave the fleet half-updated without anyone knowing. First, why nothing happened: a ConfigMap consumed as environment variables is read once at container start, and a Deployment's template did not change, so the controller had no reason to roll. Design, restart path: the base Helm chart adds an annotation on the Pod template with a checksum of the rendered ConfigMap and Secret (checksum/config: {{ sha256sum }}); any change alters the template and triggers an ordinary rolling update through the same probes, PDB, and surge rules as a code deploy — this is the default and covers everything. Kustomize achieves the same with generated ConfigMap name hashes. Live path, opt-in per service: mount the ConfigMap as a volume (files update in place within about a minute — not with subPath, which never updates) and let Spring Cloud's @RefreshScope beans reload from a file watch or an actuator /refresh call triggered by a small controller; limit this to feature flags, log levels, and rate limits, where a per-Pod skew of a minute is acceptable. Changes that must never be live: anything with a schema or migration, connection strings and pool sizes (a half-reloaded pool is a leak), security settings, and anything where two replicas on different values would give inconsistent answers to the same user. Everything goes through Git; kubectl edit configmap in production is denied by RBAC. What I would not do: kubectl rollout restart as the standard mechanism, because it works but is invisible to GitOps history and easy to forget.

Land it Make configuration changes roll like code by default through a checksum annotation, and let only skew-tolerant settings reload live.

Likely follow-ups
"The checksum annotation rolled the fleet when someone changed a comment in the ConfigMap. Is that acceptable?"

It is the expected cost of the mechanism, and mostly acceptable, since a rolling update with a correct manifest is safe by design; but it is worth reducing. The checksum is over the rendered ConfigMap, so a comment or a key reorder changes it. Options: compute the checksum over the data values only, sorted, which Helm can do with a small template helper; split the ConfigMap so the frequently edited, restart-worthy keys are separate from documentation-like ones; or move to Kustomize's configMapGenerator, which hashes the content the same way. What I would not do is exempt the annotation for "small" changes by hand, because the whole point is that no human decides whether a change matters. A rollout that costs nothing is the goal, and if it costs something, that is the deploy pipeline's problem to fix, not the configuration mechanism's.

"How does the live path actually work in Spring, and how fast is the volume update?"

The kubelet refreshes ConfigMap volumes on its sync loop, and the delay is the kubelet's sync period plus its ConfigMap cache TTL, so typically 30 to 90 seconds; volumes mounted with subPath never update because they are bind mounts of a single file. Spring Boot reads a mounted directory as a config tree with spring.config.import optional:configtree:/etc/config/, where each file is a property. Spring Cloud Kubernetes can watch the file and publish a RefreshEvent, or a small controller such as Reloader calls the actuator refresh endpoint; beans annotated with RefreshScope are then re-created with the new values on next use, and ConfigurationProperties beans marked for rebinding are updated. Logging levels have a dedicated actuator endpoint that changes them instantly without a refresh. Each Pod refreshes on its own schedule, so the fleet is skewed for about a minute, which is why only skew-tolerant settings may use this path.

"What about Secrets? Does the same design apply, and what changes?"

The mechanics are the same: Secrets as environment variables need a restart, as volumes they update in about a minute, and a checksum annotation on the template rolls the Pods. What changes is the rotation story. A database password or a TLS certificate must be rotated with an overlap, so the new value is valid before the old is revoked, and the fleet must pick it up in a bounded time, which the checksum rollout provides deterministically and the live path provides only if the application re-reads the file, which a JDBC pool does not. So credentials use the rollout path, and certificates use the live path only when the server reloads them, as Spring's SSL bundles can with reload-on-update. When Secrets come from the External Secrets Operator, the checksum must cover the resolved Secret, not the ExternalSecret object, which needs a Reloader-style controller rather than a Helm-time hash.

"What would you cut, and what would you insist on, if this standard had to ship this week?"

I would ship the checksum annotation in the base chart and the RBAC denial of kubectl edit configmap in production, which together make every configuration change a Git-tracked rolling update; that is a day's work. I would cut the live path entirely for now, since it needs a controller, application changes, and a list of approved keys, and I would state in the standard that it exists as a future opt-in. I would insist on the list of changes that may never be live being written down now, even without the live path, because it is the design decision that prevents someone building a hot-reload for connection strings next quarter. And I would keep kubectl rollout restart as the documented emergency fallback rather than the standard, so nobody has to invent one during an incident.

Drill · Autoscaling & stateful workloads

This group tests whether you can predict what the HPA will do with your numbers, and whether you know what a StatefulSet does when a node disappears.

Q71. "How does the HPA compute the desired replica count, how often, and what are the built-in guards against thrashing?"

Reveal answer

Strong answer Every 15 seconds the HPA controller fetches the metric for each Pod of the target and computes desired = ceiling(current replicas × current metric value ÷ target value). For CPU the value is utilisation as a percentage of the Pod's CPU request; with 4 Pods at 90 percent and a target of 60, desired is ceiling(4 × 90 ÷ 60) = 6. With several metrics it computes each and takes the largest. Guards: a tolerance of 10 percent around the ratio, so nothing changes unless the ratio is below 0.9 or above 1.1; Pods that are not Ready or are still within their startup window are treated conservatively — for a scale-up they count as using zero, for a scale-down they count as using the target — so a fleet of fresh JVMs does not trigger an immediate scale-down; a scale-down stabilisation window of 5 minutes during which the highest recommendation wins; and the behavior block, where scale-up and scale-down policies limit how many Pods or what percentage may change per period. It also refuses to act if it cannot read the metric at all, which is the silent failure mode. The bounds are minReplicas and maxReplicas, and it writes the count into the Deployment's scale subresource, which is why a manifest with a fixed replicas field fights it.

Land it The HPA is a ratio with a 10 percent dead zone, a five-minute memory on the way down, and a dependency on the metric being there — most surprises come from the request it divides by.

Likely follow-ups
"What are the exact startup windows the HPA uses for new Pods, and which flags set them?"

Two controller-manager flags. --horizontal-pod-autoscaler-initial-readiness-delay, 30 seconds by default, is the window after a Pod starts during which readiness transitions are treated as the Pod still starting, so a briefly Ready then not Ready Pod is not counted as Ready. --horizontal-pod-autoscaler-cpu-initialization-period, 5 minutes by default, is the window during which a Pod's CPU sample is ignored unless the Pod is Ready and the sample is recent, which stops warm-up CPU from driving a scale-up. The sync interval itself is --horizontal-pod-autoscaler-sync-period at 15 seconds, and the tolerance is --horizontal-pod-autoscaler-tolerance at 0.1. On managed clusters these are fixed by the provider, which is why the per-HPA behavior block is the knob I actually use. Since 1.33 a per-HPA tolerance field in the behavior block is alpha, and as of Aug 2026 it is beta on recent releases.

"Write the behavior block you would use for a typical Spring Boot service and explain each line."

scaleUp with stabilizationWindowSeconds 0 so a burst is acted on immediately, policies of type Percent value 100 periodSeconds 30 and type Pods value 4 periodSeconds 30 with selectPolicy Max, meaning at most double or plus four every 30 seconds whichever is larger, which handles both a small fleet and a large one. scaleDown with stabilizationWindowSeconds 300, the default, so the highest recommendation of the last five minutes wins and a lull does not shed capacity, and a policy of type Pods value 1 periodSeconds 60 so the fleet shrinks one Pod a minute, which keeps a scale-down from dropping below the capacity needed if the next burst comes early. For a service where scale-down is dangerous I set selectPolicy Disabled on scaleDown during a known event and re-enable it afterwards.

"How does the HPA handle memory as a metric, and why is it usually wrong for a JVM?"

Memory works mechanically like CPU: average working set as a percentage of the memory request, ratio against the target, ceiling. For a JVM it is wrong because heap usage does not fall when load falls; the JVM keeps the heap it has grown to, so utilisation stays high after a peak and the HPA never scales down, and it does not rise proportionally with load either, since the heap fills and collects in cycles. A memory-based HPA on JVMs therefore tends to pin at a high count or oscillate with GC cycles. Memory is a vertical concern: size the limit correctly with the VPA's help, and scale horizontally on something that tracks demand, request rate, queue depth, or CPU if the service is CPU-bound. The exception is a service whose memory is genuinely proportional to concurrent sessions, and even then request rate is a cleaner proxy.

"What does the HPA do if the metric is missing for some Pods but not others?"

It computes with the Pods it has and applies the conservative rules to the missing ones. For a scale-up decision, Pods with missing metrics are assumed to be at zero usage, which pulls the average down and makes the scale-up smaller or cancels it; for a scale-down decision they are assumed to be at exactly the target, which pulls the average toward the target and dampens the scale-down. If the resulting decision would change direction compared with the calculation ignoring the missing Pods, the HPA does nothing. That is why a metrics-server that returns partial data, or Pods with a container that has no request, leads to an HPA that looks alive but is much less responsive than expected. The describe output shows the number of Pods used in the calculation, which is how I spot it.

Q72 · Scenario. "An HPA never scales up even though the service is clearly saturated at peak — latency climbs, but replicas stay at the minimum. Diagnose."

Reveal answer

Strong answer I would diagnose in this order:

  1. What does the HPA see? kubectl describe hpa shows the current metric versus target and the conditions. <unknown>/60% with a FailedGetResourceMetric condition means it cannot read the metric at all: metrics-server is down or not installed, or the Pods have no CPU request, so utilisation is undefined.
  2. Ranked causes. Missing CPU request on the container (the most common). Metrics-server unhealthy. The CPU request is so high that utilisation never crosses the target — a request of 4 cores on a service that uses 1 at saturation reads as 25 percent, and the real bottleneck is thread-pool or database wait, not CPU. The HPA targets the wrong object (a stale Deployment name after a rename). The maxReplicas equals minReplicas, or a ResourceQuota blocks the new Pods so they are created but Pending. Or, for a custom metric, the adapter is not serving it.
  3. Fix. Set a CPU request that reflects real per-Pod capacity, or switch the target to a metric that actually tracks saturation — requests per second per Pod, or request queue length — through the Prometheus adapter or KEDA. Restore metrics-server; raise the maximum; free the quota.
  4. Prevention. Alert on the HPA's ScalingActive condition being false and on kube_horizontalpodautoscaler_status_current_replicas pinned at the minimum during peak; a load test that verifies the HPA reaches a higher count.

Land it An HPA that never moves is either blind or dividing by the wrong request — describe it first, and if CPU is not what saturates the service, stop scaling on CPU.

Likely follow-ups
"Metrics-server is healthy and there is a CPU request, and it still does not scale. What is left?"

Then the HPA is computing correctly and the number is genuinely below target, so the service is saturated on something other than CPU. I would check the Pod-level CPU against the request: if the Pods use 300m of a 1000m request at the moment latency climbs, the bottleneck is elsewhere, and the usual candidates are the Tomcat thread pool at its maximum with requests queueing, the HikariCP pool exhausted with threads waiting on connections, or a downstream that answers slowly so every thread is parked. All of those look like low CPU and high latency. The fix is to scale on what saturates: a request-rate metric per Pod through the Prometheus adapter or KEDA, or a queue-length metric. And separately to check whether more Pods would even help, since more Pods against an exhausted database only make it worse.

"Show the actual describe output that tells you the request is missing."

kubectl describe hpa orders shows Metrics as resource cpu on pods with a value like unknown over 60 percent, and in Conditions, ScalingActive False with reason FailedGetResourceMetric and a message such as "missing request for cpu in container app of Pod orders-7d9". The Events section repeats that message every 15 seconds. If the container has a request but another container in the Pod, a sidecar, does not, the message names that container instead, and since 1.27 the HPA can target a single container with a type ContainerResource metric to avoid the sidecar problem. A target with unknown and AbleToScale True is the signature: the HPA can act, but has nothing to act on. When metrics-server itself is down the reason is the same but the message mentions the metrics API being unavailable.

"How would you set up a requests-per-second metric for the HPA, concretely?"

Two ways. With the Prometheus adapter, a rule in its ConfigMap with seriesQuery matching http_server_requests_seconds_count with the namespace and pod labels, a resources mapping of those labels to Kubernetes namespace and pod, and a metricsQuery that computes sum(rate(...[2m])) by pod; the HPA then uses a metric of type Pods, name http_requests_per_second, target type AverageValue, averageValue 150. With KEDA, a ScaledObject with a prometheus trigger holding the PromQL query and a threshold, and KEDA manages the HPA for me and can scale to zero. I verify with kubectl get --raw on the custom metrics API and compare the value with the dashboard before trusting it. The request-rate target should be set from a load test at about 60 percent of the per-Pod capacity so scaling starts before saturation.

Q73 · Scenario. "After a Prometheus upgrade, an HPA on a custom metric stopped scaling and now sits at maxReplicas. Nobody changed the HPA. Explain what could have happened and how you would confirm it."

Reveal answer

Strong answer Diagnosis order: sitting at the maximum means the HPA is receiving a value that is far above target, or received one and then lost the metric — the HPA does not scale down when it cannot read a metric, and it keeps the last recommendation within the stabilisation window logic, so a stale high number can pin it. Evidence: kubectl describe hpa for the current value and any FailedGetPodsMetric condition; then query the custom metrics API directly with kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1/namespaces/shop/pods/*/http_requests_per_second to see what the adapter returns. Ranked causes: the Prometheus upgrade changed a metric name or label (a renamed job label, a new relabelling), so the adapter's rule now matches nothing or matches a total rather than a per-Pod series — a per-Pod rate that accidentally sums across all Pods is exactly what would read as huge; the adapter's seriesQuery matched a different series after the upgrade; or the adapter itself lost access to the new Prometheus endpoint and serves errors, leaving the last high value in force. Fix: correct the adapter rule and confirm the raw API returns a per-Pod value close to what the dashboard shows; if the adapter is broken, the HPA will hold at the maximum, which is at least safe for users and expensive for the bill. Prevention: an alert on FailedGetPodsMetric, a contract test in the monitoring pipeline that queries the custom metrics API for each HPA after any Prometheus change, and KEDA as an alternative, whose scalers query Prometheus directly with a PromQL expression you can test in the Prometheus UI.

Land it A custom-metric HPA is only as honest as the adapter's mapping — after any monitoring change, query the metrics API by hand before trusting the replica count.

Likely follow-ups
"The adapter is fixed and the HPA still sits at maxReplicas. Why has it not scaled down?"

Several dampers stack after a fix. The scale-down stabilisation window keeps the highest recommendation from the last five minutes, so it takes at least that long. The scaleDown policy may limit the rate to one Pod a minute, so from 40 back to 4 is half an hour. If the fixed metric now shows a genuinely high value because the fleet is large and the per-Pod rate is low, the ratio is below target and it will shrink, but if the query still returns a sum rather than a per-Pod rate, the number is still huge; kubectl get --raw on the custom metrics API per Pod is the check. And if the HPA had been failing to get metrics, the ScalingActive condition must return to True first, which happens on the next successful sync. I would watch the HPA's events for SuccessfulRescale with the new count rather than the replica count alone.

"How would you write a contract test for the metric?"

A small CI job that runs against staging after any monitoring change. For each HPA that uses a custom or external metric, it queries the custom metrics API for one Pod of the target and asserts three things: the request returns 200 with a value, the value is within an order of magnitude of the same quantity computed directly against Prometheus for that Pod, and the number of Pods returned equals the Deployment's replica count. It also asserts the metric name and label set the adapter rule expects still exist in Prometheus, by querying the series directly. The job fails the monitoring change's pull request if any assertion fails. That catches the renamed label before it reaches production, which no amount of alerting after the fact replaces.

"Why would you consider KEDA over the Prometheus adapter here?"

Because the metric definition lives with the workload instead of in a shared adapter ConfigMap. With the adapter, every team's metric is a rule in one platform-owned ConfigMap, a change there affects everyone, and the mapping from series to Pods is indirect and easy to break. With KEDA, the ScaledObject sits in the team's namespace next to the Deployment, carries the PromQL query verbatim so it can be pasted into the Prometheus UI, and each service has its own trigger with its own threshold. KEDA also brings scale-to-zero, a fallback replica count when the metric source is unreachable, and triggers for Kafka lag and queue depth without more adapters. The cost is another operator to run and, since KEDA creates the HPA, one more layer to understand when debugging. For a fleet with several custom metrics I would choose it.

Q74 · Design. "Design the autoscaling strategy for a service whose traffic goes from 200 to 5,000 requests per second within 90 seconds at unpredictable times, several times a day, where JVM startup takes about a minute."

Reveal answer

Strong answer Requirements: a 25× burst in 90 seconds with a one-minute Pod start means reactive scaling alone cannot keep up — by the time new Pods are Ready the burst has peaked. Assumptions: about 250 requests per second per Pod at the latency target, so 20 Pods at peak and 1–2 at trough. Design, in layers. Headroom: keep a floor of 6 Pods — enough for the first 30 seconds of a burst at degraded latency — and set the HPA target on requests per second per Pod at 150, well below the 250 capacity, so scaling starts early. Fast scale-up: HPA behavior with zero stabilisation on the way up and a policy allowing 200 percent per 15 seconds; a 10-minute stabilisation on the way down so bursts a few minutes apart reuse capacity. Node capacity: the cluster autoscaler adds a node in 2–4 minutes, too slow, so run an over-provisioning Deployment of placeholder Pods at a negative PriorityClass that reserve two nodes' worth of room; when real Pods arrive they preempt the placeholders instantly, and the autoscaler replaces the placeholders' room in the background. Karpenter shortens node provisioning to about a minute but still needs the buffer. Faster starts: cut JVM startup with class data sharing or Spring AOT, or GraalVM native images where feasible, to bring Pod readiness to 10–20 seconds — this is the highest-leverage change. Load shedding: a rate limiter at the gateway and a readiness-based overload signal so the surviving Pods degrade rather than collapse during the ramp. If the bursts have any external trigger — a scheduled push notification, a TV ad — a KEDA cron scaler pre-scales before the event. What I would not do: scale on CPU (it lags request rate and JVM warm-up makes it noisy), set the floor to one Pod to save money, or trust the cluster autoscaler to provide nodes in time.

Land it For a 90-second burst, capacity has to already exist — a floor, an early trigger, pre-reserved nodes, and faster JVM starts do what reaction cannot.

Likely follow-ups
"The requirement changes: the bursts are now predictable, always at the top of the hour. What do you drop and add?"

I add a KEDA cron trigger that raises the minimum replicas to the peak count five minutes before each hour and lowers it fifteen minutes after, so the capacity exists before the burst without any reaction time, and I keep the request-rate trigger as the fallback for any burst that arrives off-schedule. I can drop most of the over-provisioning buffer, because the cron scaler triggers node provisioning early enough for the autoscaler to keep up, and I can lower the floor between bursts to two or three Pods, which is where the savings come from. I would keep the fast JVM start work, since it also shortens rollouts, and the load shedding, since predictions fail. The over-provisioning Deployment could shrink to one node's worth as insurance rather than two.

"What would you cut if you had a day, and what does the service look like during a burst after those cuts?"

I would ship the floor of six Pods and an HPA on CPU with an aggressive scale-up policy, because that needs no adapter, and set the node group minimum high enough to hold twenty Pods so node provisioning is out of the picture; that is a larger steady-state bill but a working system today. I would cut the request-rate metric, the placeholder Deployment, and the startup work. During a burst, the six Pods absorb the first 30 seconds at degraded latency, CPU crosses the target within one or two HPA cycles, Pods are created immediately since nodes exist, and about 60 seconds after the burst begins the new Pods are Ready. So the user sees roughly a minute of slow responses per burst, which is what I would tell the product team while the full design is built.

"How does the over-provisioning Deployment actually work, and what are its pitfalls?"

It is a Deployment of pause-image Pods with resource requests sized to reserve capacity, say ten Pods of 2 CPU and 4 GiB each, using a PriorityClass with a negative value such as minus one and preemptionPolicy Never. They occupy nodes so the autoscaler keeps those nodes; when a real Pod cannot be scheduled, the scheduler preempts the placeholders in seconds, and the placeholders become Pending, which triggers the autoscaler to add a node for them in the background. Pitfalls: the placeholders must have requests that resemble the real Pods' shape, or preempting several may not free a slot the real Pod fits; they cost the reserved capacity permanently; and a PDB or a tight ResourceQuota in their namespace can block preemption. The cluster autoscaler's own priority-expander and Karpenter's disruption budgets need to know about them so consolidation does not fight the buffer.

"Why not scale on latency directly, since that is what the users feel?"

Because latency is a lagging, non-linear, and self-referential signal. It rises only once the service is already saturated, so scaling on it starts late; it does not tell the HPA how many Pods to add, since doubling Pods does not halve p99; and it is affected by things scaling cannot fix, such as a slow database, so a downstream problem would drive the fleet to maxReplicas for nothing. Request rate per Pod is a leading signal with a linear relationship to the replica count: if capacity is 250 per Pod and traffic is 5,000, I need 20 Pods, and the HPA's ceiling formula computes exactly that. Latency belongs in the SLO alert and, in a canary analysis, as a comparison signal; as an autoscaling input it is the thing I am protecting, not the thing I measure to decide.

Q75 · Scenario. "An HPA scales a service from 4 to 9 and back to 4 every few minutes, all day. Costs are up and latency is spiky. What is happening and how do you calm it?"

Reveal answer

Strong answer Diagnosis order: oscillation is a feedback loop where the scaling action changes the metric it is measuring. Evidence: the HPA events show alternating scale-up and scale-down with the metric crossing the target in both directions; overlay the replica count with the CPU per Pod. Ranked causes. One: JVM startup — new Pods burn CPU compiling and warming for a minute, so right after a scale-up the average utilisation across Pods rises, which pushes another scale-up; once they warm, utilisation collapses below target and the scale-down fires, then the reduced fleet heats up again. Two: the target is too close to the natural operating point with a 10 percent tolerance, so ordinary noise crosses it. Three: someone set the scale-down stabilisation window to zero, or the readiness probe passes before warm-up so the new Pods count immediately. Fixes: scale on a metric that does not depend on the Pod's own warm-up — requests per second per Pod; keep the default 5-minute scale-down window and add a scale-down policy of at most one Pod per minute; make readiness pass only after warm-up so new Pods are excluded from the average until they are useful; and widen the gap between the up and down decisions by targeting 60 percent rather than 80. Prevention: a rule that CPU-targeted HPAs on JVM services must have a startup-aware readiness probe, and a dashboard panel that shows replica count changes per hour.

Land it Scaling on a metric that scaling itself disturbs is an oscillator — move to request rate, slow the way down, and keep cold Pods out of the average.

Likely follow-ups
"You switched to requests per second and it still oscillates. What now?"

Then the oscillation is coming from the traffic or from the timing, not the metric's warm-up dependence. I overlay the raw request rate with the replica count: if the traffic itself pulses every few minutes, for example a client with a polling loop or a batch upstream, the HPA is correctly following a pulsing input, and the fix is the scale-down window and rate policy, or a target with more headroom so the pulses stay inside the tolerance band. If the traffic is flat and the count still moves, I check the metric's rate window: a rate over 30 seconds is noisy and crosses the target on jitter, whereas a two-minute window smooths it. And I check for a second scaler, a KEDA object and a raw HPA both targeting the Deployment, which fight each other; kubectl get hpa shows both, and only one may own the scale subresource.

"How does the 10 percent tolerance create a band, and how do you widen it?"

The HPA compares the ratio of current metric to target and acts only when it is below 0.9 or above 1.1, so for a CPU target of 60 percent the fleet is left alone between 54 and 66 percent utilisation. That band is narrow relative to normal noise on a small fleet, where one Pod's GC cycle moves the average several points. Widening it cluster-wide is a controller-manager flag on self-managed clusters; per HPA, the practical levers are a lower target with the scale-down policy limiting the descent, which makes the up and down thresholds effectively asymmetric, and the per-HPA tolerance field in the behavior block on releases where it is available as of Aug 2026. The other lever is fleet size: at four Pods each one is 25 percent of the average, and the same noise at twelve Pods is a third of that, so a slightly higher floor calms the arithmetic.

"What does the oscillation cost, and how do you show the business that calming it is worth the engineering time?"

Two costs, both measurable. Compute: every scale-up creates five Pods that live for a few minutes, so over a day the service runs perhaps 40 percent more Pod-hours than a steady fleet of six would, which I can compute from kube_pod_container_resource_requests summed over time, and price. Latency: each new Pod serves cold for its first minute, JIT compiling and warming caches, and each scale-down evicts warm Pods and pushes their load onto the rest, so the p99 spikes on every cycle; overlaying the replica-count changes on the latency graph shows the spikes align with them. A dashboard panel of scaling events per hour next to p99 and Pod-hours makes the case in one picture. The fix is a few lines of HPA configuration and a readiness change, so the return on a day's work is immediate.

"How would you make readiness pass only after warm-up in Spring Boot?"

With a custom readiness indicator or by publishing the readiness state from an ApplicationRunner. On startup the runner sets ReadinessState REFUSING_TRAFFIC, runs the warm-up, which is typically a few hundred synthetic requests through the real code paths against a test tenant or a replayed sample, plus priming the connection pool and any local caches, and then publishes ACCEPTING_TRAFFIC. The readiness probe returns 503 until then. The startup probe budget must cover the warm-up, so it grows by the warm-up time, and the rollout takes correspondingly longer, which is the price of a Pod that is useful the moment it receives traffic. The warm-up should be bounded by a timeout so a slow dependency cannot keep a Pod unready forever, and it should be measured, because a warm-up that takes longer than the burst is worse than none.

Q76 · Design. "Design how the Vertical Pod Autoscaler and the Horizontal Pod Autoscaler coexist for a fleet of 80 services without fighting."

Reveal answer

Strong answer Requirements: right-sized requests over time and responsive replica counts, without the two controllers undoing each other. The conflict: the HPA on CPU utilisation divides usage by the request; if the VPA changes the request, utilisation jumps and the HPA reacts to a phantom change, and in automatic mode the VPA evicts Pods to apply new requests, which the HPA then counts as capacity loss. Design: split the resources. The HPA owns horizontal scaling and targets a metric that does not depend on requests — requests per second per Pod, or queue depth — or, if CPU, then the VPA is configured with controlledResources: ["memory"] so it never touches the CPU request the HPA divides by. The VPA runs in Off (recommendation) mode for every service by default, with recommendations exported to a dashboard and turned into pull requests, and in Auto mode only for services that have no HPA at all — batch and background workers, where a periodic restart to apply memory changes is harmless. Both are bounded: VPA minAllowed and maxAllowed per container, and a LimitRange that caps what either can produce. Ownership is explicit through server-side apply field managers so the GitOps agent ignores replicas and the request fields the VPA manages. Trade-offs: recommendation mode means a human merges the change, which is slower but auditable; in-place resize may soon let the VPA apply memory changes without evictions, at which point I would widen Auto mode. What I would not do: run both in automatic mode on CPU for the same Deployment, or let the VPA set limits — it should scale requests and leave the memory limit equal to them.

Land it Give each controller its own dimension — HPA scales count on a request-independent metric, VPA advises on memory — and make the ownership explicit so GitOps does not become a third combatant.

Likely follow-ups
"Why exactly does the HPA misbehave when the VPA changes a CPU request? Walk me through the arithmetic."

The HPA computes utilisation as current usage divided by the request. Say a Pod uses 400 millicores against a 500 millicore request, so utilisation is 80 percent and the target is 70 percent; the HPA wants more replicas. Now the VPA raises the request to 1,000 millicores. The same 400 millicores is now 40 percent utilisation, so the HPA thinks the service is over-provisioned and scales in, even though nothing about the load changed. Worse, in Auto mode the VPA evicts Pods to apply the new request, and for a minute the HPA sees fewer Ready Pods and higher per-Pod usage on the survivors, and scales out. The two controllers are each reacting to the other's side effects. That is why I keep the HPA on a metric that has no request in the denominator, or fence the VPA away from CPU.

"Does in-place Pod resize change this design? Where is that feature as of today?"

It changes the eviction half of the problem, not the arithmetic half. In-place resize lets the kubelet change a running container's CPU and memory requests without recreating the Pod; as of Aug 2026 it is beta and on by default since 1.33, and the VPA has an InPlaceOrRecreate update mode that tries an in-place change first and falls back to eviction. So a memory recommendation can land without a restart, which makes Auto mode much safer for services with an HPA. What it does not fix is that the HPA's utilisation number still jumps when a request changes, so the HPA should still target requests per second or use controlledResources: ["memory"] on the VPA. I would widen Auto mode to memory-only for HPA-managed services once I have verified on a canary that the JVM's heap sizing does not fight the new memory limit.

"How would you verify in production that the two are not fighting?"

I would look for oscillation signatures. From kube-state-metrics I plot kube_horizontalpodautoscaler_status_desired_replicas and the VPA's recommended target from its status object over 24 hours for each service; a sawtooth in replicas that lines up with VPA-triggered evictions is the fight. I also count evictions with the vpa_updater_evictions_total-style metrics the updater exposes, and correlate them with HPA scale events in the exported Events stream. A cheap alert: more than three HPA direction changes in 15 minutes for the same Deployment. And a periodic review of the Deployment's managedFields to confirm that only the expected field managers, the HPA on replicas and the VPA on the request fields, are writing, and Argo is not reverting either one.

"What would you cut if you had one week to roll this out across the 80 services?"

I would cut the automation and keep the fence. Day one, install the VPA with a VerticalPodAutoscaler object per service in updateMode: "Off", generated by the platform chart, so every service gets recommendations and nothing changes. Day two, add controlledResources: ["memory"] to all of them so even a later switch to Auto cannot touch CPU. Day three, a dashboard of recommendation versus request per service. That alone gives the right-sizing signal and cannot cause an outage. I would defer Auto mode entirely, defer the GitOps field-manager work, and defer switching HPAs to request-rate metrics, because each of those needs a per-service check. The order is chosen so that if the week ends early, what has shipped is purely observational.

Q77. "How does a StatefulSet perform a rolling update, what does the partition field do, and what happens if ordinal 1 fails its probe mid-update?"

Reveal answer

Strong answer With the default RollingUpdate strategy, the StatefulSet controller updates Pods one at a time in reverse ordinal order — highest first — deleting each Pod and recreating it with the new template, and waiting for it to be Running and Ready before moving to the next lower ordinal. That order means the lowest ordinals, which are often the leader or the first replica other members bootstrap from, change last. The partition field is a canary control: with partition: 2 on a 4-Pod set, only ordinals 2 and 3 are updated and 0 and 1 stay on the old revision until you lower the partition; lowering it to zero completes the rollout. That is the standard way to test a new database or broker version on one member first. If ordinal 1 is recreated and never becomes Ready, the update stops there: ordinals 2 and 3 are on the new version, 1 is broken, 0 is untouched, and the controller waits indefinitely — StatefulSets have no progress deadline. Since 1.31, maxUnavailable on the rolling update can let more than one Pod update at a time for sets where ordering does not matter. Recovery from the stuck state is manual: fix the template and the controller will recreate ordinal 1 with the fix, or roll the template back, which updates 3, 2, then 1 back to the old version — again one at a time, again waiting on readiness, which is why a broken probe on a StatefulSet is much more painful than on a Deployment.

Land it StatefulSets update one ordinal at a time from the top and stop at the first failure — the partition is your canary, and a stuck ordinal is your problem to fix, not the controller's.

Likely follow-ups
"Why reverse ordinal order? What would go wrong if it updated ordinal 0 first?"

Because ordinal 0 is the member other members bootstrap from. In many clustered systems the first replica is the seed: new members join by contacting db-0, and some operators or entrypoints elect ordinal 0 as the initial leader. If the update recreated ordinal 0 first and the new version was broken, the seed would be down, and the higher ordinals could not rejoin after their own restart, so a bad rollout would lose the whole set. Updating from the top means the newest version is tested on the members least likely to be the seed, and a failure stops the rollout with the seed and the lower members untouched and still serving. It is the same principle as canarying at the edge rather than at the core, applied inside one StatefulSet.

"How would you canary a new Postgres or Kafka version with the partition field, step by step?"

With a four-member set I would first set spec.updateStrategy.rollingUpdate.partition: 3 and then change the image tag in the template. Only ordinal 3 is recreated on the new version. I watch it for as long as the workload needs to exercise it, at least one full replication cycle and a peak, checking its readiness, its replication lag, and the application error rate from that member. If it is fine, I lower the partition to 2, then 1, then 0, each time waiting for the new ordinal to be Ready and the metrics to be clean. If ordinal 3 misbehaves, I revert the template image; because the partition is still 3, only ordinal 3 is recreated back to the old version and the rest never changed. The partition is the rollback boundary as much as the canary boundary.

"Ordinal 1 is stuck not Ready mid-update. What do you actually do, in order?"

First I stop the rollout from going further by setting the partition to 2, so the controller will not touch ordinal 0 whatever I do next. Then I read kubectl describe pod db-1 and kubectl logs db-1 --previous to learn whether the failure is the new version or the environment: a schema incompatibility, a changed configuration key, or a data directory the new version refuses. If it is the version, I revert the template image and the controller recreates ordinal 1 on the old version, and I decide separately whether to roll ordinals 2 and 3 back by lowering the partition. If it is a stuck Pod rather than a broken version, I delete the Pod so the controller recreates it against its existing PVC. I never delete the PVC, and I never force-delete while the previous container might still be writing.

"When would you use maxUnavailable on a StatefulSet, and what does it require?"

Only for sets where ordering and quorum do not matter: sharded caches, workers that each own a fixed partition, or any system that tolerates several members restarting at once. It requires the MaxUnavailableStatefulSet feature gate, which as of Aug 2026 is beta and on by default since 1.31 on most managed distributions, and the field goes under rollingUpdate.maxUnavailable with an absolute number or a percentage. I would not use it for anything quorum-based, because restarting two of three etcd-style members at once loses quorum even if the update itself is fine. I would also pair it with podManagementPolicy: Parallel only when the startup order truly does not matter, since that policy also affects scale-up and scale-down.

Q78 · Scenario. "A node hosting kafka-2 of a three-broker StatefulSet went NotReady 15 minutes ago. The Pod shows Terminating and no replacement is being created. Under-replicated partitions are climbing. What do you do, and what must you not do casually?"

Reveal answer

Strong answer Diagnosis order: this is the StatefulSet at-most-one guarantee at work. After the node went unreachable, the Node controller issued deletions for its Pods; a Deployment's Pod would simply be replaced, but the StatefulSet controller will not create a new kafka-2 until the API server confirms the old one is gone — and it cannot, because the kubelet that must acknowledge the termination is unreachable. The Pod sits in Terminating with a deletionTimestamp forever. Evidence: kubectl get node shows NotReady; the Pod's status has a deletionTimestamp; the StatefulSet's events say it is waiting. Options in order of safety. One: bring the node back or confirm it is truly dead — if the cloud instance is terminated, deleting the Node object (kubectl delete node) tells the control plane the kubelet will never answer, the Pod is garbage-collected, and the controller recreates kafka-2, whose PersistentVolumeClaim reattaches its disk on a new node in the same zone (the cloud detach may take a few minutes). Two: if the node is alive but partitioned, force-deleting the Pod (kubectl delete pod kafka-2 --force --grace-period=0) removes the object without the kubelet's agreement — and the old broker may still be running on the partitioned node with the same identity, which is a split-brain risk for anything that relies on identity, though Kafka's controller fencing limits the damage. That is the thing not to do casually: force-delete is right only when you know the old process is dead or the storage cannot be attached twice. Prevention: a node-problem detector plus an automated fencing step that terminates the instance before deleting the node, and, for Kafka specifically, running it through an operator such as Strimzi that handles broker replacement and rebalancing.

Land it The StatefulSet is refusing to create a second kafka-2 on purpose — prove the first one is dead by killing the node, and reach for force-delete only when you can prove it another way.

Likely follow-ups
"You deleted the Node object and kafka-2 came back, but under-replicated partitions are still climbing. What next?"

Then the new kafka-2 is running but is not yet a healthy in-sync replica. I would check three things. Did the PVC attach to the new Pod, or is it stuck in ContainerCreating with a Multi-Attach error because the cloud disk still thinks it is on the dead node; kubectl get volumeattachment tells me. Is the broker actually caught up, which I read from Kafka's UnderReplicatedPartitions and the replica lag per partition, because a broker that was away 15 minutes has a backlog to fetch before it rejoins the in-sync set. And is the cluster's controller still healthy, since with a three-broker KRaft quorum losing one member is fine but a second failure is not. If the disk is stuck, I wait for the six-minute force detach rather than yanking it. If the lag is large, I confirm fetch throughput is rising and let it replicate.

"What exactly is the split-brain risk with force-delete, and how does Kafka limit it?"

The risk is two processes claiming the same identity. If the old node is alive but cut off from the API server, the old kafka-2 process is still running with broker ID 2 and its disk. Force-deleting the Pod makes the control plane create a new kafka-2 elsewhere, and now two brokers with the same ID exist. For a naive stateful system that could mean two writers on the same logical data. Kafka limits it because the KRaft controller quorum fences brokers by epoch: a broker that lost contact is fenced and clients stop writing to it, and when the network heals the old process finds its epoch is stale and cannot rejoin. The disk protects the rest, since a ReadWriteOnce volume cannot be attached to two nodes. So the damage is bounded, but I still would not rely on it casually.

"How would you automate this so nobody has to make that decision at 3 a.m.?"

Two pieces. First, fencing: the cloud's node-lifecycle integration, for example the AWS node termination handler or Karpenter's interruption handling, watches for instance termination and deletes the Node object promptly, so a truly dead instance is cleaned up without a human. For a node that is alive but unreachable, a fencing controller such as Medik8s' Node Healthcheck plus Self Node Remediation terminates the instance through the cloud API after a timeout and only then deletes the Node, which turns "is it dead?" into a certainty. Second, the operator: Strimzi understands broker identity and will handle the replacement Pod, its disk, and rebalancing partitions with Cruise Control. I would also set unreachable tolerations on the broker Pods to a shorter tolerationSeconds so the deletion attempt starts sooner.

"Would a Deployment have behaved differently here, and why is that not the answer?"

A Deployment would have created a replacement Pod immediately, because it only guarantees a count, not an identity, and the ReplicaSet controller does not wait for the old Pod to be confirmed gone. That is fine for stateless services, which is why they heal within a minute of a node loss. It is the wrong answer for a broker because a Kafka broker's identity is its ID plus its disk; a new Pod without the same PVC would be an empty broker with a new ID, partitions would need to be reassigned and re-replicated from scratch, and the old data would be orphaned. The StatefulSet's slowness is the price of keeping the name and the volume together. So the fix is faster, safer fencing, not a different controller.

Q79 · Design. "Design a production Kafka deployment on Kubernetes for a 20-service platform — or make the case for not running it in the cluster."

Reveal answer

Strong answer Requirements: durable, ordered messaging for 20 services, a few thousand messages per second, survive a zone loss, and be upgradeable without a maintenance window. If I run it in-cluster: the Strimzi operator, with a Kafka custom resource describing three brokers in KRaft mode (no ZooKeeper), one per zone through the operator's rack awareness, each as a StatefulSet-like Pod with its own PersistentVolumeClaim on a WaitForFirstConsumer StorageClass with local or zonal SSD, memory request equal to limit, no CPU limit, a dedicated tainted node pool so brokers never share nodes with bursty services, a PDB of maxUnavailable: 1, and topics with replication factor 3 and min.insync.replicas 2 so a zone loss keeps the cluster writable. The operator handles rolling upgrades broker by broker, certificate rotation, and partition rebalancing through Cruise Control, which is what makes in-cluster Kafka operable at all; running it as a hand-written StatefulSet is the version I would refuse. Observability through the operator's Prometheus exporters, alerts on under-replicated partitions and disk. The honest case against: a managed service (MSK, Confluent Cloud, Aiven) removes broker operations entirely; for a 20-service platform with a small platform team the total cost of in-cluster Kafka — the pool, the on-call knowledge, the upgrade drills — usually exceeds the managed price, and the cluster's own upgrades become risk events for the message bus everything depends on. I would run it in-cluster only where a managed option is unavailable (on-premises, air-gapped), where data egress or residency makes managed pricing unworkable, or where the team already operates Kafka well and wants the same tooling everywhere. What I would not do: run Kafka on the general node pool with default StorageClass network disks and hope the StatefulSet handles a node failure by itself.

Land it If it must be in-cluster, it is Strimzi on its own pool with zonal disks and rack awareness — and the default answer for a 20-service shop is still the managed service.

Likely follow-ups
"The requirement changes: it is now 200 services and 500,000 messages per second. Does the answer flip?"

It moves the trade-off, not the principle. At that volume the managed price becomes a large line item, often six figures a year, and data egress between the managed service and the cluster matters, so in-cluster Kafka on a dedicated pool with local NVMe can be materially cheaper. It also means the platform now has a team that can justify Kafka expertise. So I would seriously consider Strimzi at that scale, but with more conditions: nine or more brokers across three zones, a separate KRaft controller quorum rather than combined nodes, tiered storage to object storage for retention, Cruise Control for rebalancing, and a dedicated on-call rotation. The question I would ask first is whether the organisation will fund that rotation; if not, the managed service is still right even at 500,000 messages per second.

"Why local or zonal SSD rather than the default network disk, and what does that cost you?"

Kafka's write path is sequential appends and fsync, and its read path relies on the page cache; both are sensitive to disk latency, and a network-attached disk adds a millisecond or more per fsync and can throttle on IOPS. Local NVMe gives sub-millisecond latency and very high throughput. The cost is durability semantics: a local disk dies with the node, so the data on that broker is gone and must be re-replicated from the other two. With replication factor 3 and min.insync.replicas 2 that is acceptable, since the data exists elsewhere, but a node replacement means a full re-sync of that broker's partitions, which can take hours for terabytes. Zonal persistent SSD is the compromise: it survives the node, reattaches to a replacement in the same zone, and is fast enough for most workloads.

"How does a Kubernetes cluster upgrade interact with an in-cluster Kafka, concretely?"

Node rotation drains each node, and each drain evicts a broker. The PDB of maxUnavailable: 1 means only one broker is down at a time, and with min.insync.replicas 2 the topics stay writable. But each eviction triggers leader elections for that broker's partitions, and clients see brief errors while they refresh metadata, so the upgrade shows up as a small error blip per broker. Strimzi's drain cleaner helps here: it intercepts the eviction and performs its own rolling restart, waiting for the broker to be back in sync before allowing the next. Without an operator, a fast drain across zones can cut two brokers close together and drop below the in-sync minimum. That interaction, where a cluster maintenance task becomes a message-bus incident, is the core of my argument for keeping it out.

"What would you cut under time pressure if forced to ship in-cluster Kafka this quarter?"

I would not cut the operator, the three-zone placement, replication factor 3, or the dedicated pool, because those are the difference between a Kafka and a data-loss incident. I would cut Cruise Control rebalancing at first, and rebalance manually when adding brokers. I would cut tiered storage and accept shorter retention. I would cut per-topic authorisation and start with TLS plus a single client credential per service, adding ACLs later. And I would cut the fancy dashboards down to four panels: under-replicated partitions, offline partitions, disk usage per broker, and consumer lag. What I would still insist on before go-live is one rehearsed broker-loss drill and one rehearsed node drain, because those are the two events that will definitely happen.

Q80 · Design. "Design a one-off data migration of 400 million rows that must run on Kubernetes, survive Pod restarts and node preemption, and never be run twice by accident."

Reveal answer

Strong answer Requirements: resumable, idempotent, observable, and impossible to double-run. Design: a Job, not a CronJob, created by the pipeline with a unique name tied to the migration's identifier so a second apply is a no-op; parallelism: 8, completions: 8, completionMode: Indexed, so each Pod owns one eighth of the key range by its JOB_COMPLETION_INDEX; backoffLimit: 20 with a podFailurePolicy that ignores failures caused by disruption (preemption, eviction) so spot interruptions do not exhaust retries, and fails fast on an application exit code that means "data invariant broken"; restartPolicy: Never so failed Pods remain for forensics; activeDeadlineSeconds as a global ceiling; ttlSecondsAfterFinished of a week. Resumability lives in the database, not in the Pod: each worker processes batches of 5,000 rows in a keyset-paginated loop and records its high-water mark in a migration_progress table inside the same transaction as the batch, so a restarted worker reads its mark and continues — the same batch-commit discipline the Database Primer describes. Idempotency: writes are upserts keyed on the natural key, so a batch replayed after a crash is harmless. Never-twice: the migration inserts its own row in a migrations table with a unique constraint before starting and marks it complete at the end; a second run finds the row and exits zero immediately. Resources: Guaranteed QoS, on the batch pool, with a PriorityClass that never preempts. Observability: a progress metric per index pushed to Prometheus, and the Job's conditions watched by the pipeline. What I would not do: one Pod doing everything (no parallelism, all-or-nothing), state in an emptyDir, or a script run from an engineer's laptop with a kubeconfig.

Land it The Job provides retries and parallelism; the database provides the checkpoint and the lock — put the state where it survives, and the Pods can die as often as they like.

Likely follow-ups
"Why Indexed completion mode rather than a work queue? What do you lose?"

Indexed mode gives each Pod a stable number from 0 to completions - 1 in the JOB_COMPLETION_INDEX environment variable, and if a Pod fails, its replacement gets the same index. That lets me map index to key range deterministically, so each worker knows which slice is its own without any coordination service, and a restarted worker resumes its own slice from its own checkpoint. A work-queue design would instead have Pods pull batches from a queue table, which balances better if some ranges are much heavier, but requires a claim-and-lease mechanism with timeouts to recover batches from dead workers. For a one-off migration with reasonably uniform keys, the fixed slicing is simpler and the failure story is cleaner. If the key distribution were badly skewed, I would switch to a claim table with SELECT ... FOR UPDATE SKIP LOCKED.

"The Job is at index 5 of 8 done, and index 3 keeps failing with a data error. What now?"

Because restartPolicy: Never keeps failed Pods, I read the failed Pod's log to find the offending batch and its high-water mark from migration_progress. If it is a bad row that violates an invariant, the fix is in the data or the code, not the Job: I correct the row or handle the case, build a new image, and create a new Job with the same migration identifier. The new Job's workers read their marks, and indexes 0 through 2 and 4 through 7 find themselves complete and exit zero immediately; index 3 resumes from its mark. The podFailurePolicy rule that fails the Job fast on the "invariant broken" exit code is what stopped it retrying 20 times. What I would not do is edit the database mark by hand to skip the row.

"How do you guarantee never-twice if two engineers apply the Job at the same second?"

The Kubernetes side already prevents the obvious case: a Job name is unique within a namespace, so the second kubectl apply of migrate-orders-2026-08 either updates or is rejected, and does not create a second Job. The database side covers everything else, including a differently named Job or a laptop run: the first statement each worker executes is an insert into migrations (id, started_at) with a unique constraint on id, inside a transaction. The second process gets a unique-violation error and exits zero with a log line saying "already running or done". Because the constraint is enforced by the database, it works across clusters, across namespaces, and across humans. The Job name is a convenience; the row is the lock.

"What does this cost the database, and how do you keep it from hurting production traffic?"

Eight workers each writing 5,000-row batches can generate a lot of write-ahead log and replication lag, and upserts on a large table churn the indexes. I would size the batch and the parallelism from a test run on a copy, targeting a replication lag ceiling, and build a throttle into the loop: after each batch the worker checks replica lag or a simple sleep of a few hundred milliseconds. I would run it in a low-traffic window, keep parallelism adjustable by editing the Job, since lowering it is allowed on a running Job, and put a Prometheus alert on lag and on p99 latency for the production service that shares the database. A migration that must never be run twice must also be one you can pause, and lowering parallelism to zero is the pause button.

09 · DrillNetworking, Configuration, Storage & Security — Q81–Q115

Networking questions are where a candidate's mental model is tested most directly, because the failures are so specific: the name resolves but the connection hangs, one Pod takes all the traffic, adding a policy breaks DNS. Configuration, storage, and access control follow, because they are where the "it works" answer and the "it is safe" answer diverge. Thirty-five questions; several of them ask you to design a boundary rather than a feature.

Drill · Services, routing & DNS

These questions test whether you can follow a packet from one Pod to another and say what rewrote it, who chose the destination, and when that choice was made.

Q81. "State the Kubernetes network model in one rule, and explain what the CNI plugin does when a Pod starts and why the choice of plugin matters in production."

Reveal answer

Strong answer The rule: every Pod has its own IP address that is reachable from every other Pod in the cluster, on any node, without network address translation. Kubernetes does not implement that rule itself; it defines the Container Network Interface and delegates to a plugin. When the kubelet creates a Pod, it creates a network namespace and calls the plugin, which allocates an IP from the node's range, creates a virtual interface pair between the Pod and the node, and installs routes — and on some plugins, encapsulates cross-node traffic in a VXLAN tunnel, or on others uses the cloud's routing tables or gives Pods real VPC addresses. The choice matters in four ways. Whether NetworkPolicies are enforced at all — Calico and Cilium do, some cloud defaults did not. Performance — eBPF-based Cilium avoids iptables for Services and can bypass the encapsulation path. IP capacity — the AWS VPC CNI ties Pods per node to the instance's network interface limits, which is a real scheduling constraint. And observability — Cilium's Hubble shows flows between Pods with policy verdicts, which turns "connections time out" from a mystery into a query. The plugin runs as a DaemonSet, and if it is unhealthy on a node, new Pods there stay in ContainerCreating with a sandbox error.

Land it One IP per Pod, flat and routable, delivered by a plugin — and the plugin decides whether your policies mean anything and how many Pods a node can hold.

Likely follow-ups
"Overlay versus native routing: what is the actual difference on the wire and when does it matter?"

With an overlay such as VXLAN, a packet from Pod A on node 1 to Pod B on node 2 is wrapped inside a UDP packet between the two node addresses, so the underlying network only ever sees node-to-node traffic. That works on any network but costs about 50 bytes of headers per packet, which lowers the usable MTU to around 1,450, and a little CPU for encapsulation. With native routing, the Pod CIDR of each node is installed in the cloud route table or advertised by BGP, so Pod IPs travel unwrapped and the network delivers them directly. Cloud CNIs like the AWS VPC CNI go one step further and give Pods real VPC addresses. Native routing matters when throughput is high, when MTU mismatches bite, and when security groups or VPC flow logs need to see Pod IPs.

"A Pod is stuck in ContainerCreating with a sandbox error on one node. What do you check first?"

The CNI agent on that node, because the kubelet calls the plugin to create the network namespace and cannot proceed without it. kubectl get pods -n kube-system -o wide filtered to that node shows whether the Cilium or Calico Pod is Running and Ready; its logs say why not. Then I check IP exhaustion: on the AWS VPC CNI, kubectl describe node shows the allocatable Pod count derived from the instance's network interface limits, and if the node is at that limit new Pods cannot get an address. Then the node's own state: /etc/cni/net.d present, the plugin binary in /opt/cni/bin, and the kubelet log mentioning the plugin. Meanwhile I cordon the node so the scheduler stops sending new Pods to a node that cannot network them.

"How many Pods can a node actually hold, and what sets that number?"

Two limits, and the lower one wins. The kubelet's maxPods defaults to 110 and is a plain configuration value. The CNI can impose a lower one: on the AWS VPC CNI each Pod needs a secondary IP on an elastic network interface, and an instance type allows a fixed number of interfaces times addresses per interface, so an m5.large gets 29 Pods unless prefix delegation is enabled, which raises it to 110. On GKE the default per-node Pod CIDR is a /24, which allows about 110 Pods. On an overlay CNI it is the size of the per-node Pod range. This matters for capacity planning because a node can be at 30 percent CPU and still be "full" for scheduling, which shows up as Pending Pods with a "Too many pods" filter reason.

"How would you verify that NetworkPolicies are actually enforced on a given cluster?"

I would not trust documentation; I would test it. Create a namespace, run two Pods, confirm one can reach the other with curl, apply a default-deny NetworkPolicy with an empty podSelector and both policy types, and repeat the request. If it still succeeds, the CNI does not enforce policies; the object was accepted and did nothing. On Cilium, cilium status on an agent and hubble observe --verdict DROPPED show enforcement and the dropped flow. I would run this test as a conformance check in the platform's cluster acceptance suite, because managed clusters have shipped with policy enforcement off by default, and the gap is invisible until someone assumes a policy protected them.

Q82. "Nothing listens on a ClusterIP. So how does a connection to it reach a Pod, and what keeps the list of destinations current?"

Reveal answer

Strong answer A ClusterIP is an address that exists only in the packet-rewriting rules of every node. The chain: the EndpointSlice controller watches Pods and Services; when a Pod matching a Service's selector becomes Ready, it adds the Pod's IP and port to one of the Service's EndpointSlices (each holds up to 100 endpoints, replacing the older single Endpoints object that did not scale). kube-proxy on every node watches EndpointSlices and programs the kernel: "a packet whose destination is this ClusterIP and port gets its destination rewritten to one of these Pod IPs, chosen randomly, and the reverse rewrite applies to replies". So when a Pod connects to the ClusterIP, its own node's kernel performs the rewrite before the packet leaves, and the packet crosses the network carrying the real Pod IP. The list is kept current in two ways: readiness changes flow through the same watch, so a Pod failing its readiness probe disappears from the slice within a second or two; and Pod deletion sets the endpoint to terminating, which since 1.26 lets kube-proxy keep routing to it for connections already established while excluding it for new ones. The lag between a change and every node having the new rules is the source of the deploy-time errors covered in the rollout questions.

Land it The Service is a rule, not a process — the EndpointSlice is the list the rule reads, and readiness is what edits the list.

Likely follow-ups
"How long does it take for a readiness change to reach every node, and what makes it slow?"

Typically one to two seconds end to end on a healthy cluster. The kubelet runs the probe and updates the Pod's Ready condition, the EndpointSlice controller in the controller manager observes the Pod change through its watch and rewrites the slice, and kube-proxy on each node observes the slice change through its own watch and reprograms the kernel. Each hop is a watch, so there is no polling delay. It gets slow when the API server is under load and watch events lag, when kube-proxy in iptables mode is rebuilding a very large ruleset and has a minimum sync period, or when a node's kube-proxy is unhealthy and simply stops updating. That last case is the dangerous one: the node keeps routing to Pods that no longer exist, and only that node's clients see errors.

"What happens to established connections when a Pod is removed from the EndpointSlice?"

Nothing, immediately. The rewrite decision was made at connection time and is recorded in the kernel's conntrack table, so packets on an existing TCP connection keep flowing to the same Pod IP regardless of what the rules now say. Only new connections are affected by the updated rules. That is why a Pod removed from the slice can still finish in-flight requests during its termination grace period, and why kube-proxy since 1.26 tracks terminating endpoints so that, if all endpoints are terminating, it still routes to them rather than dropping. The flip side is that a Pod that has actually died leaves stale conntrack entries, and clients holding connections to it see timeouts until the kernel notices, which is the reason for keepalives and connection lifetimes on the client.

"Why did Endpoints not scale, and does anything still use it?"

The old Endpoints object held every address of a Service in a single object, so a Service with 2,000 Pods was one large object rewritten on every readiness flip, and every kube-proxy on every node received the entire object each time. At a few thousand endpoints that is megabytes of churn per change multiplied by the node count. EndpointSlices split the list into chunks of up to 100 addresses by default, so a single Pod change touches one small slice. As of Aug 2026 the Endpoints API is deprecated and controllers should read slices; the mirroring controller still populates Endpoints for compatibility, and a few older tools and custom controllers read them. In a code review I would flag anything that still lists Endpoints.

"A Service has a selector but the EndpointSlice is empty. Give me the causes in order."

First, no Pod is Ready: the readiness probe fails or the Pods are Pending, so nothing qualifies; kubectl get pods -l app=orders shows it. Second, the selector does not match: a label typo, or the Deployment's Pod template labels differ from the Service selector, which is easy to miss when both say app but with different values. Third, the port mismatch is a related trap: the slice is populated but the targetPort names a container port that does not exist, so connections are refused. Fourth, the Pods are in a different namespace than the Service, because selectors do not cross namespaces. Fifth, publishNotReadyAddresses is not the fix here, but it is worth knowing it exists for headless Services that need addresses before readiness.

Q83. "Compare kube-proxy's iptables, IPVS, and nftables modes and Cilium's eBPF replacement. What breaks first at 5,000 Services, and which would you run today?"

Reveal answer

Strong answer iptables mode writes a chain of rules per Service and per endpoint, evaluated linearly, and updates them by rewriting large parts of the ruleset; with 5,000 Services and tens of thousands of endpoints, each update takes seconds and every new connection walks a long chain, so both rule propagation delay and per-connection latency degrade — that is what breaks first. IPVS mode uses the kernel's in-kernel load balancer with hash-table lookups, so lookup cost is constant and it offers real algorithms (least-connection, source hashing), but it still needs iptables for some paths and has had maintenance and edge-case issues, which is why the project is steering away from it. nftables mode, stable since 1.33 and the default direction as of 1.37, keeps the familiar packet-filter model but uses maps and sets, so updates are incremental and lookups are constant-time. eBPF with Cilium removes kube-proxy entirely: a program at the socket layer intercepts connect() for ClusterIPs and rewrites the destination before any packet exists, with a hash-map lookup, so Service resolution costs nothing per packet and there is no rule propagation at all — the map update is the propagation. Today I would run Cilium with kube-proxy replacement on any cluster I control, for the performance, the policy enforcement, and the flow visibility; on a managed cluster where the provider owns the data plane, nftables mode when it is offered, IPVS or iptables otherwise, with a plan to move.

Land it Linear rule chains are what fail at scale — maps fix lookup, eBPF removes the rewrite from the packet path entirely, and that is where the project and I are both heading.

Likely follow-ups
"How would you measure that iptables mode is the bottleneck before recommending a migration?"

Three measurements. Rule sync time: kube-proxy exposes kubeproxy_sync_proxy_rules_duration_seconds, and if the p99 is above a second the propagation delay is real; I would also watch kubeproxy_network_programming_duration_seconds, which measures from an endpoint change to the rules being live. Rule count: iptables-save | wc -l on a node, where tens of thousands of lines is the danger zone. And connection setup latency: a synthetic client measuring time to first byte to a ClusterIP versus a Pod IP directly; the difference is the rule-chain cost. If those numbers are healthy at the current scale, the migration is not urgent and I would plan it for the next cluster rebuild rather than as an in-place change.

"What does enabling Cilium's kube-proxy replacement require, and what can break?"

It requires a kernel with the needed eBPF features, roughly 5.10 or newer for full socket-level load balancing, and a Helm value of kubeProxyReplacement: true with kube-proxy removed or its DaemonSet scaled down so the two do not both program the node. Things that can break: NodePort and LoadBalancer behaviour differs slightly, so anything relying on externalTrafficPolicy semantics needs retesting; host-network Pods that connect to ClusterIPs behave differently because the socket-level hook operates in the host namespace; and some tools that inspect iptables to debug will find nothing there. I would roll it out on a new node pool first, verify Service reachability with a conformance test, and then drain the old pool.

"On a managed cluster where I cannot replace kube-proxy, which mode should I pick as of today?"

nftables mode. As of Aug 2026 it is stable, and the project has been steering new clusters toward it as the successor to iptables; several providers offer it as a cluster option or a kube-proxy configuration flag, --proxy-mode=nftables. It keeps the same semantics as iptables mode, so nothing about Service behaviour changes for applications, while updates become incremental and lookups constant-time. IPVS remains an option if nftables is not offered, and it scales lookup well, but the project has been maintaining rather than developing it. If the provider only offers iptables, I would set the sync period settings so rule rebuilds are batched, keep the Service count in check, and put the data-plane choice on the list for the next cluster.

"What breaks at 5,000 Services that has nothing to do with the packet path?"

DNS and API load. CoreDNS holds a record per Service and answers search-list expansion queries for all of them, and every kube-proxy and CNI agent on every node holds a watch on every EndpointSlice, so 5,000 Services with churn means thousands of watch events per second fanned out to hundreds of nodes, which is API server and etcd load. The environment-variable injection is another quiet one: by default every Pod gets environment variables for every Service in its namespace, so a namespace with 500 Services gives every container thousands of variables, slowing container start; enableServiceLinks: false on the Pod turns that off. And ClusterIP address space: a /16 Service CIDR holds 65,000 addresses, but a /20 runs out at 4,000.

Q84 · Scenario. "From inside a Pod, the Service name resolves to an IP, but the connection times out. Other Pods can reach the same Service. Walk me through the diagnosis."

Reveal answer

The real test Whether you separate name resolution from routing from policy, and know a check for each layer.

Strong answer I would diagnose in this order:

  1. Confirm the layer. Resolution works, so DNS is fine. A timeout — not connection refused — means packets are being dropped somewhere, not rejected. Since other Pods succeed, the difference is about this Pod: its node, its namespace, or its labels.
  2. Evidence. From a debug container in the failing Pod: connect directly to a backend Pod IP and port, bypassing the Service; if that also times out, the problem is Pod-to-Pod, not the Service. Compare kubectl get endpointslices -l kubernetes.io/service-name=orders — if it is empty, no Pod is Ready and everyone would fail, so that is not it here. Check whether the failing Pod's node differs from the working ones.
  3. Ranked causes. First, a NetworkPolicy: a default-deny in the caller's namespace without an egress rule to the target, or an ingress policy on the target that allows a namespace label the caller's namespace lacks — policies drop silently, producing exactly a timeout; Cilium's Hubble or Calico's flow logs show the verdict. Second, a node-level problem: kube-proxy or the CNI agent unhealthy on that one node, so its rules are stale (kubectl get pods -n kube-system -o wide for that node); a cloud security group or route table that excludes a new node or subnet. Third, MTU: cross-node traffic over an overlay with a mismatched MTU passes small packets (the TLS handshake starts) and drops large ones — a "hangs after connecting" pattern rather than a pure timeout. Fourth, the target's own readiness excluding the only Pod in this zone while internalTrafficPolicy: Local or topology-aware routing restricts callers to same-zone endpoints.
  4. Fix and prevention. Fix the policy or the node agent; standardise policies through a tested base; alert on CNI and kube-proxy DaemonSet Pods not Ready; and keep the flow-log tool installed before the incident, not during it.

Land it Resolves but times out means dropped, and dropped in a cluster is a policy or a broken node agent nine times out of ten — test the Pod IP directly to prove which.

Likely follow-ups
"You tested the backend Pod IP directly and that also times out. What does that narrow it to?"

It removes the Service from suspicion entirely, so kube-proxy rules and the EndpointSlice are not the cause. The problem is Pod-to-Pod, which leaves policy, node networking, or MTU. I would then test from the same failing Pod to a Pod on the same node as itself and to a Pod on the target's node; if same-node works and cross-node fails, it is the node's overlay, routes, or a cloud security group. If both fail, it is a policy on the caller or on the target. Cilium's hubble observe --from-pod shop/checkout-abc shows the verdict directly. And I would check whether the failing Pod's node recently joined, because a new node missing from a security group or route table produces exactly this pattern for every Pod on it.

"How do you tell an MTU problem from a policy drop?"

By the shape of the failure. A policy drop fails at the first packet: the TCP handshake never completes, so curl hangs at connecting and a packet capture shows SYN retransmits with no SYN-ACK. An MTU problem lets small packets through: the handshake completes, a small HTTP request may even succeed, and the connection hangs when a large response or a TLS certificate exchange needs a full-size packet that is silently dropped. The test is ping -M do -s 1400 and then 1472 to the target Pod; if the large one fails with a fragmentation-needed error or a silent drop, it is MTU. The fix is aligning the CNI's MTU with the underlying network minus the overlay overhead, typically 1450 on VXLAN over a 1500 network, or 8950 on jumbo frames.

"The policy fix did not work: you added an egress rule and it still times out. What next?"

First I check the rule I wrote is the rule I meant. The classic mistake is putting namespaceSelector and podSelector as two list items, which means OR, or forgetting that the target namespace needs the label my selector names; kubectl get ns --show-labels confirms. Then I check the other side: egress allowed on the caller is not enough if the target has an ingress policy that does not include the caller. Then I check DNS egress, because if the Pod cannot reach CoreDNS, resolution fails before connection, though here the name resolved so that is not it. Then I look at the flow log for the actual verdict rather than reasoning from YAML. If the CNI shows the flow as allowed and it still times out, I am back to node networking, and I move the Pod to another node to test.

"What would you put in place so this diagnosis takes five minutes instead of an hour?"

Three things. A flow-visibility tool installed before the incident, Hubble or Calico flow logs, with a saved query for "dropped flows from namespace X in the last 15 minutes". A standard network debug image, such as netshoot, pre-approved so an ephemeral container can be launched without a policy exception. And a checklist in the runbook in the order of layers: resolve, then connect to the Service, then connect to a Pod IP, then same-node versus cross-node, then large-packet ping. With those, the first two commands usually name the layer. I would also keep an alert on CNI and kube-proxy DaemonSet Pods not Ready per node, because a broken node agent is the cause that no amount of application-side testing reveals.

Q85. "Why can a Service 'load balance' and still send all traffic to one Pod? Explain the connection-level behaviour, and what changes for gRPC and HTTP/2."

Reveal answer

Strong answer The Service chooses a backend once per new connection, at the moment of the TCP handshake, on the client's node. After that, the connection is a fixed pair of addresses tracked by the kernel's connection table and every packet follows it. A client with a keep-alive HTTP pool — a Java HttpClient, RestTemplate on Apache HttpClient, a HikariCP-style pool of HTTP connections — opens a few connections and reuses them for minutes or hours, so the distribution across Pods was decided by a handful of random choices at startup and never revisited. If the pool opened two connections and both hit Pod A, Pod A gets everything. Scaling the target from 3 to 6 Pods does nothing for that client until it opens new connections. gRPC and HTTP/2 make this worse by design: one connection multiplexes every request as a stream, so a client naturally holds a single long-lived connection and a Service distributes at the connection level, meaning one backend per client, forever. Fixes, in order of preference: an L7 proxy that balances per request — a Gateway API implementation, a mesh sidecar, or Envoy in front of the Service; client-side load balancing with a headless Service so the gRPC client sees all Pod IPs and round-robins streams itself; or, crudest, a maximum connection age on the server so clients reconnect periodically and re-roll the dice.

Land it Services balance connections, not requests — anything that keeps connections open needs an L7 balancer or a client that knows the Pod list.

Likely follow-ups
"Which concrete settings would you put on a Java client so it does not pin to one Pod?"

For Apache HttpClient behind RestTemplate, a PoolingHttpClientConnectionManager with a connection time-to-live of around 30 to 60 seconds, set through setConnectionTimeToLive, and evictIdleConnections so idle ones are closed. For the JDK HttpClient there is no per-connection TTL, so I rely on the server side or the property jdk.httpclient.keepalive.timeout. For Spring WebClient on Reactor Netty, ConnectionProvider.builder().maxLifeTime(Duration.ofSeconds(60)). On the server side, Tomcat's server.tomcat.keep-alive-timeout and max-keep-alive-requests at around 100 force clients to reconnect and re-roll. The idea in every case is the same: connections must expire, so the Service gets to choose again regularly and a new Pod receives traffic within a minute of becoming Ready.

"How does a gRPC client with a headless Service actually balance, and what does it need?"

A headless Service, clusterIP: None, makes DNS return every Ready Pod's IP as A records instead of one virtual address. A gRPC client configured with the dns:///orders.shop.svc.cluster.local target and the round_robin load-balancing policy opens one connection to each address and spreads streams across them. What it needs: the client must re-resolve, which grpc-java does on connection failure and on a configurable interval, so a scale-up is noticed only after re-resolution; the readiness change must propagate through DNS, which CoreDNS serves from its watch with a short TTL; and the client must handle a Pod disappearing by dropping that subchannel. It does not need a proxy, which makes it the cheapest fix, at the cost of every client library needing the configuration.

"Does a service mesh solve this completely, and what does that cost per hop?"

With sidecars, yes for gRPC and HTTP: the sidecar terminates the client's single connection and opens its own pool to the backends, balancing each request or stream. As of Aug 2026 Istio's ambient mode does the same for HTTP through a per-node ztunnel plus optional waypoint proxies, at less memory cost. The price is roughly a millisecond per hop of added latency in the sidecar model, 50 to 100 MiB of memory per Pod, and a second thing to debug in every trace. It also does not help for traffic that bypasses the mesh, such as calls from outside the cluster or to workloads not enrolled. So the mesh solves it as a side effect of a bigger decision, and I would not adopt one purely for balancing when connection recycling or client-side round-robin is a configuration change.

"How would you see this in production before a customer does?"

With a per-Pod panel, not an average. The signal is the spread of request rate or CPU across the Pods of one Deployment: a query like max by (deployment) (rate(http_server_requests_seconds_count[5m])) divided by the minimum, and an alert when the ratio exceeds three for ten minutes. A second signal is the count of established connections per Pod from the application's server metrics, Tomcat's tomcat_connections_current or Netty's equivalent. And after every scale-up, the HPA's target versus the new Pods' request rate; a Pod that has been Ready for five minutes and receives under ten percent of its share is pinned traffic. Those panels also show the fix working, because after connection TTLs are set the spread collapses to near one within the TTL.

Q86 · Scenario. "After scaling checkout from 3 to 9 Pods, one Pod is at 85 percent CPU and the other eight are nearly idle. The HPA keeps adding Pods that also stay idle. Diagnose and fix."

Reveal answer

Strong answer Diagnosis order: uneven load that scaling does not fix is connection pinning. Evidence: kubectl top pods confirms the skew; on the hot Pod, ss -tn from an ephemeral container shows most established connections coming from a small set of client IPs — likely the gateway's Pods or one upstream service with a keep-alive pool; the idle Pods have few or no connections. The HPA sees the average CPU across nine Pods, which is low, and yet latency is bad because the one hot Pod is saturated — the average hides it — and each new Pod receives nothing because no new connections are being opened. Ranked causes: an upstream with a long-lived keep-alive pool (HTTP/1.1 with high max-connection age or gRPC), an external load balancer forwarding to a NodePort with externalTrafficPolicy: Local where most traffic enters through one node, or a client with a hard-coded Pod IP obtained from a headless Service and cached. Fixes: at the client, set a maximum connection lifetime (for example 60 seconds) or a per-request balancing library; at the platform, put an L7 proxy in the path — route the Service through the Gateway or a mesh so balancing is per request; at the server, a Tomcat or Netty maximum keep-alive request count so connections are recycled. Also change the HPA to a per-Pod request-rate metric with a target that would detect a single hot Pod, or add an alert on the maximum, not the average. Prevention: a platform rule that internal HTTP clients configure connection recycling, documented in the service template.

Land it The HPA averaged away a hot Pod that pinned connections created — recycle the connections or balance at layer 7, and scale on a metric that sees the maximum.

Likely follow-ups
"You set a 60-second connection lifetime on the upstream client and the skew is still there an hour later. What next?"

Then the pinned connections are not coming from the client I changed. I go back to the evidence: ss -tn state established on the hot Pod and group by source IP. If the sources are the gateway proxy's Pods, the proxy has its own upstream pool with its own keep-alive settings, Envoy's max_connection_duration or nginx's keepalive_time, and that is where the lifetime must be set. If the sources are a node IP rather than a Pod IP, the traffic is arriving through a NodePort with source NAT and the load balancer is pinning by node, so the fix is IP-target mode on the load balancer. If the source is one service that does not use the library I changed, it needs its own change. And I confirm the change actually deployed, because a config that lives in a ConfigMap read at startup does nothing until the Pods restart.

"Why did the HPA make it worse instead of helping, and what metric would have caught it?"

The HPA computes the average utilisation over all Pods, so one Pod at 85 percent and eight at 5 percent averages to about 14 percent, well below any target, and yet the HPA added Pods because it had scaled up during the original burst and was still in its stabilisation window; every Pod it added lowered the average further and received no traffic. The average is blind to distribution. A per-Pod request-rate metric with a target such as 200 requests per second per Pod would not have fixed the skew either, but an alert on the ratio between the busiest and the average Pod would have fired within minutes. The senior point is that the HPA is the wrong tool for a distribution problem; it can only change the count, and the count was never the issue.

"What are the trade-offs of recycling connections every 60 seconds?"

Each new connection costs a TCP handshake, and for TLS a handshake with a certificate exchange, which is about one round trip plus CPU on both ends; at 60 seconds and a pool of 20 connections that is a negligible fraction of a second per minute. The risk is the reconnect moment: if a request is in flight when the lifetime expires, a badly implemented client can fail it rather than wait, so the pool must retire connections between requests, which Apache HttpClient and Reactor Netty both do. For gRPC, a server-side maxConnectionAge with a maxConnectionAgeGrace sends GOAWAY so the client drains gracefully. Too short a lifetime, say five seconds, turns into handshake load and the well-known thundering-reconnect pattern after a deploy, so I stay in the 30 to 120 second range.

"Would you prefer an L7 proxy or client-side fixes for 200 services?"

For 200 services I would want the platform fix, because a client-side setting must be configured correctly in 200 codebases across several HTTP libraries and will drift. Routing internal calls through the Gateway API implementation, an internal Gateway with HTTPRoutes and per-request balancing, or a mesh, makes the balancing correct by default and observable in one place. The cost is an extra hop for internal calls and one more piece of infrastructure to size and page on. My practical path is both: connection recycling in the service template as the baseline, because it also protects against dead-peer hangs, and the L7 path for gRPC and for the few high-fan-in services where a hot Pod hurts most. I would not put a proxy on every internal call on day one.

Q87. "Explain how a Pod resolves 'orders' versus 'api.stripe.com', why ndots:5 makes external lookups slow, and what NodeLocal DNSCache changes."

Reveal answer

Strong answer Each Pod's /etc/resolv.conf is written by the kubelet: the nameserver is the CoreDNS Service's ClusterIP, the search list is <namespace>.svc.cluster.local svc.cluster.local cluster.local plus the node's domains, and options ndots:5. The resolver's rule: if a name has fewer than ndots dots, try it with each search suffix appended before trying it as written. orders has zero dots, so the first attempt is orders.shop.svc.cluster.local, which CoreDNS answers from its watch of Services — one query, a hit. api.stripe.com has two dots, fewer than five, so the resolver first tries api.stripe.com.shop.svc.cluster.local, then the other suffixes — three to five queries that each return NXDOMAIN, each of which CoreDNS may forward upstream — before the real name is tried. Multiply by A and AAAA record lookups and one external call costs ten DNS queries. Fixes: a trailing dot on external names in configuration (api.stripe.com. is a fully qualified name and skips the search list), or dnsConfig.options ndots: 2 on Pods that mostly talk externally. NodeLocal DNSCache is a DaemonSet that runs a caching resolver on each node's link-local address; Pods query it instead of the CoreDNS Service, so hits never leave the node, misses are forwarded over TCP to CoreDNS, and the conntrack-table race conditions that caused the famous five-second UDP timeouts disappear.

Land it ndots:5 turns every external hostname into a handful of doomed cluster lookups — a trailing dot fixes the client, and a node-local cache fixes the cluster.

Likely follow-ups
"Why is ndots five in the first place? Why not just set it to one everywhere?"

Five was chosen so that every in-cluster short form works: orders (zero dots), orders.shop (one), orders.shop.svc (two), and older forms with more labels. If ndots were one, orders.shop would be tried as an absolute name first, fail upstream, and only then be searched, which is slower for the common internal case and leaks internal names to the upstream resolver. Lowering it per Pod to two is safe if that Pod's internal calls use at most one dot or fully qualified names, and it makes external lookups a single query. The trade-off is consistency: a fleet where some Pods have ndots two and some five behaves differently for the same name, so I would set it in the platform chart with a documented rule rather than per team.

"How would you see this cost in production and quantify it?"

CoreDNS's metrics. coredns_dns_responses_total by rcode shows the NXDOMAIN rate; a healthy cluster has a small fraction, and a cluster suffering from search-list expansion shows NXDOMAIN outnumbering NOERROR by three or four to one. coredns_dns_request_duration_seconds gives latency, and the forward plugin's coredns_forward_requests_total shows how many queries went upstream, which is the ones that cost money and time. On the application side, a trace with a span for DNS resolution, or simply the connect time in the HTTP client's metrics, shows tens of milliseconds before the first byte. A quick estimate: 10 queries per external call at 2 milliseconds each is 20 milliseconds of pure overhead on every call to Stripe.

"Where does NodeLocal DNSCache sit in the path, and what happens when it dies?"

It runs as a DaemonSet that binds a link-local address such as 169.254.20.10 on each node and installs a rule so that traffic to the CoreDNS ClusterIP is redirected there without NAT, or on some setups the kubelet's --cluster-dns is pointed at the local address directly. Cache hits are answered on the node; misses are forwarded over TCP to the CoreDNS Service. If the local Pod dies, the iptables rules it installed are cleaned up on graceful shutdown so traffic falls back to CoreDNS through the normal path; if it is killed uncleanly, the redirect can linger and DNS on that node stops until it restarts, which is why it has a liveness probe and a high priority class. I would alert on its DaemonSet being not Ready on any node.

"What is the JVM's own role here? Does it cache DNS answers?"

Yes, and it matters. The JVM caches successful lookups for the value of networkaddress.cache.ttl, which defaults to 30 seconds when a security manager is not set, and negative lookups for networkaddress.cache.negative.ttl, 10 seconds by default. That cache is in front of the resolver library, so the ndots cost is paid once per 30 seconds per name per JVM, not on every request; the pain is worst for short-lived processes and for clients that resolve many distinct names. Setting the TTL to 60 seconds is reasonable in Kubernetes, since Services keep their ClusterIP; setting it to forever, which older defaults did, breaks failover to a new address. I would also check the container's resolver is glibc or musl, because musl in Alpine handles search domains and parallel queries differently.

Q88 · Scenario. "Across the whole cluster, about 1 percent of outbound calls take exactly 5 seconds longer than usual, then succeed. No service is unhealthy. What is it and how do you fix it?"

Reveal answer

Strong answer Diagnosis order: a delay of exactly five seconds that then succeeds is a DNS query timeout followed by a retry — five seconds is glibc's default resolver timeout. Evidence: application traces show the time spent before the connection is opened, not in the request; CoreDNS metrics show no errors, because the query never arrived; conntrack -S on nodes shows insert_failed counts rising. Cause: the well-documented race in the kernel's connection tracking for UDP — a Pod sends the A and AAAA queries in parallel from the same source port, both packets hit the NAT rule for the CoreDNS ClusterIP at the same time, the conntrack insertion for the second one fails, and it is silently dropped; the resolver waits five seconds and retries. Ranked contributors: parallel A and AAAA queries (single-request-reopen in resolv.conf options works around it), the CoreDNS Service being reached through NAT at all, and under-replicated CoreDNS making the window wider. Fix, in order of effect: deploy NodeLocal DNSCache, so Pods talk to a local cache on a link-local address with no NAT and misses go upstream over TCP — this removes the race entirely and is the standard answer; scale CoreDNS with the autoscaler add-on proportional to node count; set dnsConfig.options with single-request-reopen on affected Pods as a stopgap; reduce query volume with a sane ndots. Prevention: a p99 DNS latency panel per node, and the node-local cache as part of the cluster baseline rather than an afterthought.

Land it Exactly five seconds is DNS, and cluster-wide DNS stalls are the conntrack race — a node-local cache removes the NAT hop that causes it.

Likely follow-ups
"You deployed NodeLocal DNSCache and the five-second stalls are still there for one namespace. What next?"

Then that namespace's Pods are not using the cache. First cause: a custom dnsPolicy or dnsConfig on those Pods, or a mesh sidecar that intercepts DNS and sends it elsewhere, so their queries go straight to the CoreDNS ClusterIP through NAT; cat /etc/resolv.conf in one of the Pods shows which nameserver they have. Second: the Pods run on a node pool where the DaemonSet does not schedule because of a taint or a node selector. Third: the stalls are not DNS at all for this namespace; a five-second delay can also be a TCP SYN retransmit, which by default retries after one, then three seconds, so I would check whether the delay is exactly five or roughly that, and capture with tcpdump on port 53 from the Pod to see if a query goes unanswered.

"Explain the conntrack race in more detail. Why does the second packet get dropped?"

When a Pod sends a UDP packet to the CoreDNS ClusterIP, the kernel's NAT rule picks a backend Pod and creates a conntrack entry recording the translation. The resolver sends the A and AAAA queries at the same instant from the same source port. Both packets enter the NAT path in parallel on different CPUs, each creates its own tentative entry, each may pick a different CoreDNS backend, and when the second entry is committed it collides with the first because the tuple is identical; the kernel discards the packet whose insertion lost, and that is the insert_failed counter. The resolver never sees a reply for that query and waits its full timeout. Kernel fixes narrowed the window over the years, but the clean fix is to not NAT DNS at all, which is what the node-local cache achieves.

"What does single-request-reopen actually do, and why is it only a stopgap?"

It is a glibc resolver option in /etc/resolv.conf. single-request makes the resolver send the A and AAAA queries one after another instead of in parallel, and single-request-reopen additionally opens a fresh socket, so a new source port, for the second query, which means the two never share a conntrack tuple and the race cannot happen. It costs one extra round trip per lookup and it only helps glibc; musl-based images such as Alpine ignore it, and applications that do their own resolution bypass it. It also does nothing for other UDP traffic through NAT. So it stops the bleeding on the Pods you can patch, but it is a per-Pod workaround for a node-level problem, which is why I move to the node-local cache and remove the option afterwards.

"How would you prove the fix worked rather than just believing it?"

Before and after numbers on the same three signals. The insert_failed conntrack counter per node, which I would export with node-exporter's conntrack collector or a small script, should stop increasing. The application's p99 connect time or DNS span should lose the five-second mode; a latency histogram makes that obvious because the bucket at five seconds empties. And the node-local cache's own metrics, which are CoreDNS metrics on a per-node basis, should show the hit rate and confirm queries are arriving there. I would also run a synthetic probe, a small Deployment that resolves a name every second and records the time, and keep it running permanently, because DNS stalls are the kind of problem that returns quietly after a node image change.

Q89. "Ingress versus the Gateway API — what did Ingress get wrong, what does Gateway fix structurally, and what would make you keep Ingress today?"

Reveal answer

Strong answer Ingress got two things wrong. Its schema stopped at HTTP host and path routing with TLS termination, so every real need — header matching, traffic splitting, timeouts, retries, rewrites — went into controller-specific annotations that are not portable and cannot be validated. And it had one object with no notion of who owns what, so the same Ingress carried both the platform's concerns (which load balancer, which certificate) and the application's (which path to which Service), making shared entry points a permissions problem. The Gateway API fixes both structurally. It is a family of typed resources with a role split: the platform team owns the GatewayClass (which implementation) and the Gateway (listeners, addresses, TLS), while application teams own HTTPRoute, GRPCRoute, TCPRoute objects in their own namespaces that attach to the Gateway if its policy allows; the route schema itself includes header and query matches, weighted backends, mirroring, redirects, rewrites, and timeouts, so those features are portable and validated. It is a separate CRD bundle, stable since v1.0 in 2023, implemented by Envoy Gateway, Istio, Cilium, Traefik, and the cloud load-balancer controllers. What would make me keep Ingress today: an existing controller that the organisation cannot replace yet, a cloud whose Gateway implementation lacks a feature we depend on, or a large estate of Ingress objects where migration is a project — ingress2gateway converts them, but the annotations need review. New clusters and new services get Gateway API from the start, especially since ingress-nginx reached the end of its maintenance in March 2026.

Land it Ingress was one untyped object for two owners; Gateway is typed objects per owner — and the retirement of ingress-nginx removed the last reason to start anything new on Ingress.

Likely follow-ups
"Walk me through a migration of 300 Ingress objects to Gateway API without downtime."

I would run both side by side. Install the Gateway implementation, create the Gateway with its own load balancer and address, and use ingress2gateway to convert Ingress objects into HTTPRoutes, reviewing every annotation because those do not convert cleanly: rewrites, timeouts, and rate limits become route filters or policy resources. Deploy the routes to the new Gateway and test each hostname through the new address with host-header requests before touching DNS. Then move hostnames one at a time by lowering the old DNS TTL, switching the record, and watching the new Gateway's per-route metrics and the old controller's traffic falling to zero. Keep the old Ingress controller running for two weeks as a rollback, then delete the Ingress objects and the controller. Certificates move with cert-manager by re-issuing against the Gateway listener.

"How does the Gateway decide which namespaces may attach routes, and what stops a team hijacking another's hostname?"

Two mechanisms. The Gateway's listener has allowedRoutes.namespaces.from, which can be Same, All, or Selector with a label selector; a route in a namespace that is not permitted is simply not attached, and its status condition says so. That is attachment, not hostname ownership. For hostnames, the Gateway API resolves conflicts by precedence, oldest route wins for the same match, which is not a security control. So hostname ownership needs an admission policy: a ValidatingAdmissionPolicy in CEL that checks every HTTPRoute's spec.hostnames entries end with the namespace's allowed subdomain, taken from a namespace annotation. As of Aug 2026 there is also the listener hostname field, which restricts what a listener will serve at all and is a useful second fence.

"What does the retirement of ingress-nginx mean for a cluster that still runs it?"

It means no more security patches after March 2026, on a component that terminates TLS for the public internet, which is not a tenable position. The immediate step is to pin the last release, put a web application firewall or the cloud load balancer in front for the worst exposures, and start the migration. The realistic options are a Gateway API implementation, Envoy Gateway, Cilium, or the cloud's own controller, or another Ingress controller such as Traefik or HAProxy that still accepts Ingress objects if the migration to Gateway cannot happen quickly. I would treat it as a dated project with an owner. The upside is that most of the annotation sprawl disappears, because the features teams used annotations for are first-class fields in HTTPRoute.

"Which Gateway API features are still not stable, and how does that affect your design?"

As of Aug 2026 the core, GatewayClass, Gateway, HTTPRoute, GRPCRoute, and ReferenceGrant, is stable; TCPRoute, UDPRoute, and TLSRoute sit in the experimental channel, and cross-implementation policy attachment, timeouts, and retry budgets vary by implementation. So my design keeps HTTP and gRPC on the standard channel, treats raw TCP passthrough as an implementation-specific decision, and uses each implementation's own policy resources knowingly rather than pretending they are portable. I would also check the implementation's conformance report, which the project publishes per release, before trusting a feature. The practical rule: standard-channel resources in the platform chart, experimental features only with a named owner and a plan for when the schema changes.

Q90 · Design. "Design the north-south entry for 200 HTTP services across 12 teams: TLS, certificates, routing ownership, rate limiting, and how a team ships a new route without a platform ticket."

Reveal answer

Strong answer Requirements: one public entry with high availability, per-team self-service, TLS everywhere, protection against abuse, and no platform ticket per route. Design: a Gateway API implementation — Envoy Gateway or Cilium — with one Gateway named public in an infra namespace, exposed by a single cloud LoadBalancer Service with an external load balancer in front for DDoS absorption and a web application firewall; a second internal Gateway on a private address for admin and partner traffic. Listeners for *.example.com on 443, with TLS certificates issued by cert-manager from Let's Encrypt or an internal CA through DNS validation, stored as Secrets in infra and referenced by the listener, rotated automatically. The Gateway's allowedRoutes permits routes from any namespace labelled gateway-access=public, which the platform sets when creating a team namespace. Each team owns HTTPRoute objects in its own namespaces, deployed through its own GitOps path, with a hostname allocation rule (a team may only claim hostnames under its own subdomain, enforced by an admission policy on the route's hostnames). Rate limiting and authentication are policy resources attached to the Gateway or to specific routes — Envoy Gateway's BackendTrafficPolicy and SecurityPolicy — with platform defaults and per-route overrides. Observability: access logs and per-route metrics from the proxy, exported to the shared stack. Trade-offs: one shared Gateway means one blast radius for a bad proxy config, so the proxy runs with three replicas across zones, a PDB, and canaried upgrades, and high-risk tenants can get their own Gateway. What I would not do: one LoadBalancer per service (cost and address sprawl), Ingress annotations that only one controller understands, or a platform team that hand-edits routes for other teams.

Land it One Gateway owned by the platform, routes owned by teams under an admission-enforced hostname rule, and certificates that renew themselves — self-service with a boundary is the whole design.

Likely follow-ups
"Requirement change: three of the 12 teams need their own public IP and their own certificate authority. How does the design adapt?"

The Gateway model handles that by adding Gateways, not by special-casing routes. Each of the three teams gets a Gateway in an infra namespace dedicated to them, or in their own namespace with a GatewayClass the platform allows them to use, with its own LoadBalancer Service and address. Their certificates come from a cert-manager Issuer pointing at their CA, referenced by that Gateway's listener; the shared Gateway's Let's Encrypt issuer is untouched. Their HTTPRoutes attach to their Gateway through parentRefs, and the admission hostname rule still applies. The costs are three more load balancers and three more proxy Deployments to patch and size. I would insist the platform still owns the GatewayClass and the proxy version, so the security patching remains one job.

"How does a team ship a new route, step by step, and what can go wrong?"

The team adds an HTTPRoute to their service's chart values, hostname orders.shop.example.com, path rules, and the backend Service; their GitOps pipeline applies it to their namespace. The admission policy checks the hostname is under shop.example.com, which the platform allocated to that team. The Gateway accepts the route because the namespace carries the gateway-access=public label. The proxy reloads its configuration within seconds, and the route's status shows Accepted and ResolvedRefs. DNS is a wildcard record, so nothing else changes. What goes wrong: the backend Service name is misspelled, which shows as ResolvedRefs: False; the hostname collides with an existing route, where the older route wins and theirs is ignored; or the certificate does not cover the hostname because it is outside the wildcard, which needs a new listener.

"What would you cut under time pressure, and what would you refuse to cut?"

I would cut the internal Gateway and route admin traffic through the public one with an IP allow-list policy for now. I would cut per-route rate limiting and start with one global limit at the Gateway. I would cut the access-log pipeline to the proxy's Prometheus metrics only. I would refuse to cut three things: automated certificates through cert-manager, because manual certificates expire at the worst moment; the hostname admission rule, because without it any team can shadow another's route and the mistake is silent; and the proxy's PDB plus three replicas across zones, because a single-replica proxy turns every node drain into a public outage. Those three take a day and prevent the incidents that a shared entry point is known for.

"Where is the rate limit enforced, and what happens when the limiter itself is down?"

Two levels. Local rate limiting runs inside each proxy replica with a token bucket per route, no external dependency, but it counts per replica so three replicas allow three times the nominal limit. Global rate limiting uses a shared counter service, Envoy's rate limit service backed by Redis, which is accurate across replicas but is a dependency in the request path. In Envoy Gateway, BackendTrafficPolicy expresses both. If the global limiter is unreachable, Envoy's default is fail-open, requests pass unlimited, which is the right default for availability and the wrong one for a strict abuse control. I would run the limiter with replicas and a PDB, alert on its error rate, and keep a local limit as the floor so that fail-open still has a ceiling.

Drill · Network policy & the mesh

This group tests whether you can draw a security boundary with the tools that actually enforce one, and whether you know what a mesh costs.

Q91. "Explain NetworkPolicy semantics precisely: what happens when no policy selects a Pod, when one does, how rules combine, and what a policy cannot express."

Reveal answer

Strong answer By default, with no policy selecting a Pod, all ingress and egress is allowed. The moment any policy's podSelector matches a Pod for a given direction — listed in policyTypes — that direction becomes deny-by-default for the Pod, and only traffic matched by some policy's rules is allowed. Policies are additive: multiple policies selecting the same Pod combine as a union of allows; there is no deny rule and no ordering. Within a rule, entries in a from or to list are OR-ed; a single entry combining namespaceSelector and podSelector is AND-ed (Pods with these labels in namespaces with those labels), and putting them as separate list items is OR — the most common authoring mistake. ipBlock matches CIDRs, with except. Ports restrict by protocol and port. Both ends must allow: an egress rule on the caller and an ingress rule on the target. A default-deny policy is an empty podSelector with both types and no rules. What it cannot express: layer-7 rules (paths, methods), identity beyond labels and IPs, deny lists, or cluster-wide defaults — those need CNI-specific resources such as Cilium's CiliumClusterwideNetworkPolicy, or the newer AdminNetworkPolicy API from the network-policy working group, which adds cluster-scoped, ordered, deny-capable policy that overrides namespace policies. And enforcement is the CNI's job: on a plugin that does not implement policies, the objects are accepted and silently do nothing.

Land it Selected means deny-by-default, rules only add, both sides must agree, and AND-versus-OR lives in whether two selectors share one list item — verify with a flow log, not by reading YAML.

Likely follow-ups
"Show me the AND-versus-OR mistake in YAML and how you would catch it before it ships."

The intended rule is "allow Pods labelled app=gateway in namespaces labelled tier=edge". The correct form is one list item containing both namespaceSelector and podSelector:

ingress:
- from:
  - namespaceSelector: {matchLabels: {tier: edge}}
    podSelector: {matchLabels: {app: gateway}}

The mistake is a dash before podSelector, making it a second item, which means "any Pod in an edge namespace, OR any Pod labelled gateway in my own namespace". To catch it, I would put a unit test in the platform's policy repository using a tool that evaluates policies against sample flows, such as the Cilium policy verdict simulator or netpol-analyzer, and a CI rule that flags any from or to list with more than one item for review. In production, a flow log query for allowed flows into the namespace from unexpected sources is the last line of defence.

"What is the difference between AdminNetworkPolicy and a Cilium cluster-wide policy, and which would you use?"

AdminNetworkPolicy is the upstream API from the network policy working group: cluster-scoped, with an explicit priority, with Allow, Deny, and Pass actions, evaluated before namespace NetworkPolicies, and BaselineAdminNetworkPolicy evaluated after them as the cluster default. As of Aug 2026 it is implemented by Cilium, Calico, and OVN-Kubernetes, but still carries alpha or beta versioning, so its schema may change. CiliumClusterwideNetworkPolicy is Cilium's own resource, mature, with richer matching including layer 7 and DNS names, but it ties me to Cilium. For a cluster that is committed to Cilium I would use the Cilium resource today for the layer-7 features, and write the deny baseline in AdminNetworkPolicy as well, so that the compliance-critical rule is expressed in the portable form.

"How do you allow egress to an external API by name when ipBlock only takes CIDRs?"

Standard NetworkPolicy cannot; a hostname like api.stripe.com resolves to changing addresses, and hard-coding CIDRs is fragile. Options in order: a CNI extension, Cilium's toFQDNs in a CiliumNetworkPolicy, which watches the Pod's DNS responses and allows the addresses that were returned for that name; an egress gateway, a fixed set of nodes or Pods through which all external traffic exits so the policy allows only the gateway and the gateway enforces the hostname list; or a forward proxy such as Squid or Envoy with a domain allow-list, which also gives an audit log of external calls. For a payments boundary I would use the egress proxy, because "which external hosts did this Pod talk to" then has a logged answer.

"Which traffic bypasses NetworkPolicy entirely, and does that matter?"

Host-network Pods, because their traffic originates from the node's own namespace and most CNIs do not apply Pod policies there; node-to-Pod traffic such as kubelet probes, which every CNI allows implicitly, otherwise readiness would fail under default-deny; and, on some CNIs, traffic that has been source-NATed at a NodePort, which arrives with a node IP rather than the caller's Pod IP and so cannot be matched by a podSelector. It matters for two reasons. A compromised host-network Pod, a log shipper or a CNI agent, has unrestricted reach, so those images deserve the strictest supply-chain controls. And an ingress policy that allows "from the gateway Pods" silently allows "from any node" if traffic arrives NATed, which is why I prefer IP-target load balancers and Pod-addressed proxies.

Q92 · Scenario. "A team applied a default-deny NetworkPolicy to their namespace and added an allow rule for the gateway. Now their service starts, passes readiness, and every request fails with a 500 within 50 milliseconds. Explain."

Reveal answer

Strong answer Diagnosis order: ingress works — requests reach the Pod, which is why they get 500s rather than timeouts at the gateway — and the failure is fast, so the application is failing to reach something and failing quickly. Evidence: the application logs show UnknownHostException or a connection timeout to the database; kubectl exec into the Pod and nslookup postgres.data.svc.cluster.local fails. Cause: the default-deny policy included Egress in policyTypes, so all outbound traffic is now denied, including UDP port 53 to CoreDNS — the Pod cannot resolve any name, and even if it could, it has no egress rule to the database or to any external API. Readiness passed either because it does not check the database or because the pool was created before the policy applied and the existing connections survived while new ones are blocked. The fix is the standard egress baseline every namespace needs: an allow rule to the CoreDNS Pods in kube-system on UDP and TCP 53, plus explicit egress rules to each dependency by namespace and Pod label, and an ipBlock rule for the external APIs the service calls. The team learned the sharper lesson: egress policies are as important as ingress and much easier to get wrong. Prevention: the platform ships a namespace baseline that contains default-deny plus DNS egress in one bundle, so nobody can apply the first without the second; a staging environment with the same policies; and a flow-log tool so the denied flow is visible in seconds rather than deduced.

Land it Default-deny with egress means "no DNS" until you say otherwise — ship the DNS allow in the same object as the deny, and never one without the other.

Likely follow-ups
"You added the DNS egress rule and requests still fail. What next?"

Then DNS was one of several missing egress rules. From the Pod, nslookup postgres.data.svc.cluster.local now works, so I test the connection itself, nc -zv postgres.data 5432. If that times out, the Pod needs an egress rule to the database namespace and Pod labels on port 5432, and the database namespace needs a matching ingress rule if it has policies. Then any other dependency: the cache, Kafka, the external payment API through an ipBlock or FQDN rule, and the metrics and tracing collectors, which people forget because they fail silently. The fast way is the flow log filtered to dropped egress from this Pod, which lists every dependency in a minute. If the flow log shows allowed and it still fails, I check the DNS rule targets CoreDNS by Pod label in kube-system, not by the ClusterIP, because policies match Pods not virtual addresses.

"Why did readiness pass, and what should the readiness probe have checked?"

The probe passed because it tested the process, not its dependencies. The Spring actuator health endpoint reports UP as long as the application context started and, if readiness groups are configured, the readiness group excludes the database indicator by design. That design is deliberate: a readiness probe that checks the database takes the whole service out of rotation whenever the database blips, which turns a partial failure into a total one. So I would not add the database to readiness. What I would do is have the application fail startup if a required dependency is unreachable at boot, which the startup probe then reports, and expose dependency health as a separate metric and a liveness-independent indicator. The right signal here was the error rate at the gateway, which the alerting should have caught within a minute of the policy change.

"Write me the namespace baseline bundle you would ship."

One object with the deny and the essentials, so nobody can apply half:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: {name: baseline}
spec:
  podSelector: {}
  policyTypes: [Ingress, Egress]
  ingress:
  - from:
    - namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: infra}}
      podSelector: {matchLabels: {app: gateway}}
  egress:
  - to:
    - namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: kube-system}}
      podSelector: {matchLabels: {k8s-app: kube-dns}}
    ports: [{protocol: UDP, port: 53}, {protocol: TCP, port: 53}]
  - to:
    - namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: observability}}

The team then adds per-service policies for their own dependencies. The kubernetes.io/metadata.name label is set automatically on every namespace, which makes the selectors reliable.

"How would you roll default-deny out to 150 existing namespaces without this happening 150 times?"

Audit mode first. Cilium and Calico can run a policy in audit or "log only" mode, where the verdict is recorded but not enforced; I would apply the baseline in that mode to every namespace and collect the would-be-dropped flows for a week, which produces the dependency map for each service automatically. From that map the platform generates the per-service egress policies as pull requests to each team, who confirm them. Then enforcement flips per namespace, dev first, with the flow log dashboard open. Where the CNI has no audit mode, the equivalent is to apply an allow-all policy alongside the deny, which makes the deny inert, and use the flow log to see what would match. The whole exercise is a month for 150 namespaces, and it produces the dependency inventory that the PCI and multi-tenancy designs need anyway.

Q93 · Design. "Design the network segmentation for a cluster where three payments services must be inside PCI scope and the other 150 services must stay out of it."

Reveal answer

Strong answer Requirements: the cardholder-data environment must be isolated at the network layer with auditable rules, and anything that can talk to it freely is in scope, so the design's goal is to make the in-scope set small and provable. Design: a dedicated pci namespace on a dedicated tainted node pool, so the PCI Pods never share a kernel with out-of-scope workloads — namespaces are a policy boundary, nodes are a kernel boundary, and assessors ask about both. Cluster-wide AdminNetworkPolicy (or Cilium cluster-wide policy) with a deny rule for all traffic into and out of pci that overrides anything a team could write, then explicit allows: ingress only from the payment gateway route on one port, egress only to the tokenisation provider's IP range on 443, to the PCI database in its own isolated namespace, and to DNS. Everything else in the cluster cannot reach it, and it cannot reach anything else. Within the PCI namespace, per-service policies restrict the three services to their specific pairs. Mutual TLS between the three through a mesh or SPIFFE identities so that identity is cryptographic, not label-based, since labels can be edited by anyone with namespace write. RBAC: a separate group for the PCI namespace with no membership from the general developer groups, break-glass only. Observability: flow logs from the CNI exported and retained for the audit period, with an alert on any denied flow touching the PCI namespace — denied flows are attempted crossings. Trade-offs: a separate node pool costs capacity; a separate cluster would be cleaner still and is what I would propose if the assessor's scoping is strict, because a shared control plane is itself in scope. What I would not do: rely on namespace NetworkPolicies alone (any namespace admin can loosen them), or put the PCI database on the shared data pool.

Land it Scope is bounded by what can reach the data — dedicated nodes, cluster-scoped deny that teams cannot override, identity-based TLS, and logged denials make the boundary something you can show an assessor.

Likely follow-ups
"The assessor says the shared control plane puts the whole cluster in scope. What do you do?"

I take it seriously, because it is a defensible reading: anyone with cluster-admin can exec into a PCI Pod or read its Secrets, so the control plane and everyone with admin on it are in scope. The options are to shrink the admin set and prove it, or to move PCI to its own cluster. Shrinking means: no standing cluster-admin, break-glass through a just-in-time system with approval and audit, the audit log shipped to an immutable store, and admission rules that block exec and port-forward into the PCI namespace except through the break-glass identity. If the assessor still says no, a separate small cluster for the three services is cheaper than arguing, at the cost of a second cluster to upgrade and a cross-cluster path from the gateway. I would present both with prices and let the assessor's answer choose.

"Why is label-based identity not enough, and how do SPIFFE identities close the gap?"

A NetworkPolicy allows "Pods with label app=payments-gateway". Anyone with write access to any allowed namespace can create a Pod with that label, and the policy lets it through; labels are a naming convention, not a credential. SPIFFE identity, which is what a mesh implements, gives each workload an X.509 certificate whose subject encodes its ServiceAccount and namespace, issued by the mesh's certificate authority only to Pods that actually present that ServiceAccount's token. Authorisation policies then say "only the identity spiffe://cluster/ns/pci/sa/gateway may call this service", and forging that needs the CA's key or the ServiceAccount's token, both of which are controlled. So the network policy bounds reach, and the identity check proves who is calling. An assessor accepts the second as authentication; the first is only segmentation.

"What would you cut under time pressure, and what could you never cut for a PCI boundary?"

I could defer the mesh and use TLS with per-service certificates from cert-manager between the three services, verified by the application, which is a weaker but acceptable identity story for an initial assessment. I could defer the alerting on denied flows and start with retention only. I could accept a shared node pool for a first quarter if the assessor agrees, though I would not expect them to. I could never cut the cluster-scoped deny that teams cannot override, the separate RBAC group with no general developer membership, the encrypted and retained flow logs, or the egress restriction to the tokenisation provider only. Those four are what make the boundary a boundary rather than a diagram, and each one is also a specific line in the PCI DSS requirements that the assessor will ask to see.

"How do you prove the segmentation is still intact six months later?"

Continuously, not at audit time. A scheduled Job runs a segmentation test from a Pod in a general namespace: it attempts connections to every PCI Service and port and must fail; a second Job inside the PCI namespace attempts egress to a list of disallowed destinations and must fail; both report results as metrics and the audit evidence is the time series of passes. GitOps drift detection alerts if the AdminNetworkPolicy or the PCI RBAC differs from the repository. A ValidatingAdmissionPolicy rejects any NetworkPolicy in the PCI namespace not applied by the platform's GitOps identity. And the quarterly access review is generated from kubectl auth can-i --list across every identity that can reach the PCI namespace. The point is that the proof exists before anyone asks for it.

Q94 · Design. "The CTO wants a service mesh 'for security'. Design the decision: what a mesh gives us, what it costs, and what you would do first."

Reveal answer

Strong answer Requirements as I would restate them: encryption in transit between services, service identity that does not depend on IPs or labels, and uniform telemetry — plus the unstated one, not slowing down every team. What a mesh gives: mutual TLS everywhere with automatically issued and rotated certificates bound to ServiceAccount identity (SPIFFE), authorisation policies of the form "only checkout may call orders on POST /orders", retries, timeouts, and circuit breaking as configuration, per-call golden metrics and traces without code changes, and traffic splitting. What it costs: with sidecars, an extra proxy per Pod at roughly 50–100 MiB and a millisecond or two per hop, injection and upgrade complexity, and debugging that now includes a proxy; with Istio ambient mode or Cilium's mesh, most of the per-Pod cost moves to a per-node agent, at the price of newer, less battle-tested machinery. The decision: if the driver is encryption and identity for a compliance requirement across many teams, a mesh is the right tool and ambient mode or Cilium is the cheaper shape. If the driver is "security" in the abstract, I would do three things first that cover most of the value at a fraction of the cost: default-deny NetworkPolicies with a namespace baseline, workload identity through projected ServiceAccount tokens for anything calling cloud APIs, and OpenTelemetry in the service template for telemetry — then measure what remains. Rollout, if we proceed: one namespace at a time in permissive mode, mTLS strict only after both sides are enrolled, and a rollback that is just un-labelling the namespace. What I would not do: mesh every namespace on day one in strict mode, or adopt a mesh mainly for retries that the HTTP client already does.

Land it A mesh buys identity and encryption at the platform layer, which is real — but policies, workload identity, and OpenTelemetry come first, and the mesh is adopted namespace by namespace only if a named requirement survives them.

Likely follow-ups
"What is the difference between sidecar and ambient mode, and what would make you choose sidecars anyway?"

Sidecar mode injects an Envoy proxy into every Pod, so each Pod pays the proxy's memory and each hop passes through two proxies. Ambient mode, generally available in Istio since 1.22 and mature as of Aug 2026, splits the job: a per-node ztunnel handles mutual TLS and layer-4 policy for every Pod on the node without touching the Pod spec, and an optional per-namespace waypoint proxy handles layer-7 features only for services that need them. Ambient cuts per-Pod memory and removes injection from the deploy path. I would still choose sidecars where layer-7 policy is needed on every service and the per-Pod isolation matters, where a workload needs proxy-level settings that the waypoint does not expose, or where the platform team already runs sidecars well and the migration risk is not worth it this year.

"How do you measure the latency and CPU cost of the mesh before committing?"

With a controlled comparison in staging. Take two identical namespaces running the same service and load test, one enrolled and one not, and compare p50, p99, and CPU per request under the same load; a sidecar typically adds under a millisecond at p50 and a few milliseconds at p99 per hop, and about 0.1 to 0.5 CPU cores per thousand requests per second per proxy. Measure memory per Pod with and without the proxy from cAdvisor. Then multiply by the fleet: 200 services times three replicas times 80 MiB is roughly 48 GiB of memory, which is a node or two. Finally, measure the one thing people forget: deploy time and rollout duration, because injection adds a container that must become Ready. I present those numbers next to the cost of the alternatives.

"The CTO insists. How do you roll a mesh out across 200 services safely?"

Namespace by namespace, in permissive mode. Enrol the platform's own internal tools first, so the team learns on itself. For each namespace: label it for enrolment, roll the Deployments so proxies appear, keep mutual TLS in permissive mode where both plaintext and TLS are accepted, and watch error rates and latency for a day. Only when every caller of a service is enrolled does that service move to strict mode, and the mesh's own telemetry tells you which callers are still plaintext. Authorisation policies start as audit-only where the implementation supports it. Rollback for a namespace is removing the label and rolling the Deployments. The thing that goes wrong most is a client that speaks a protocol the proxy misdetects, so any service with non-HTTP ports gets the ports named explicitly in the Service.

"What would you tell the CTO the mesh does not solve?"

It does not fix application-level security: an authorisation bug in the orders service, an injection flaw, or a leaked API key are untouched, because the mesh authenticates workloads, not users or requests. It does not protect against a compromised Pod using its own legitimate identity, since the proxy will happily encrypt the attacker's traffic. It does not cover traffic that bypasses it, such as host-network Pods, direct database connections outside the cluster, or anything on a node pool not enrolled. It does not replace NetworkPolicy for non-HTTP traffic, though it overlaps at layer 4. And it adds a control plane that is itself a target with a certificate authority in it. So "for security" needs to be turned into named requirements, and the mesh will meet some and not others.

Q95 · Scenario. "A team set externalTrafficPolicy: Local on their LoadBalancer Service to preserve client IPs. Now the cloud load balancer reports half its targets unhealthy and some clients get intermittent failures. Explain and fix."

Reveal answer

Strong answer Diagnosis order: externalTrafficPolicy: Cluster, the default, lets any node accept traffic for the Service and forward it to a Pod on any node, using source NAT — which hides the client IP but makes every node a valid target. Local disables that second hop: a node only serves the Service if it has a Ready Pod of that Service locally, and it preserves the client IP because there is no NAT. Evidence: the load balancer's health check hits the Service's healthCheckNodePort, which returns 200 only on nodes with a local endpoint; with 3 Pods on a 6-node cluster, three nodes are correctly reported unhealthy — this is expected, not a fault. The intermittent failures come from the gap: when a Pod moves during a rollout or scale-down, the node's health flips, but the cloud load balancer's health check runs every 10–30 seconds, so for that window it sends traffic to a node that has just lost its Pod, and the node drops it. Ranked fixes: keep Local but make it safe — a preStop sleep longer than the load balancer's health-check interval times its unhealthy threshold, a DaemonSet-like spread so every node has a Pod (or spread constraints across hostnames), and Pod readiness gates tied to the load balancer's target registration; or, on a modern cloud plugin, switch the load balancer to target Pod IPs directly (the AWS Load Balancer Controller's IP target mode, GKE container-native load balancing), which preserves client IPs, bypasses NodePorts and this whole class of problem, and is what I would recommend. Prevention: a platform default of IP-target mode with readiness gates, and a documented explanation of why Local with NodePorts reports "unhealthy" nodes.

Land it Local makes nodes without a Pod honestly unhealthy and creates a health-check-interval gap on every Pod move — the clean fix is a load balancer that targets Pods, not nodes.

Likely follow-ups
"What exactly is healthCheckNodePort, and how do you find it?"

When a LoadBalancer Service has externalTrafficPolicy: Local, the API server allocates an extra NodePort, visible in the Service spec as healthCheckNodePort, and kube-proxy serves an HTTP endpoint on it on every node. The endpoint returns 200 with a JSON body giving the count of local endpoints when the node has at least one Ready Pod for that Service, and 503 otherwise. The cloud controller configures the load balancer's health check to hit that port rather than the application port, so the load balancer learns which nodes can actually serve. kubectl get svc orders -o jsonpath='{.spec.healthCheckNodePort}' shows it, and curl http://<node-ip>:<port>/healthz from inside the VPC shows the node's answer. Half the targets being unhealthy is that endpoint working correctly.

"Explain the timing of the intermittent failures in seconds."

Say the load balancer checks every 10 seconds and marks a target unhealthy after two failures. A Pod on node A begins terminating; within about a second kube-proxy on A sees the endpoint leave, and A's health endpoint starts returning 503. But the load balancer only learns that after its next check, up to 10 seconds, and only acts after two failed checks, so for up to 20 seconds it still sends new connections to node A, where kube-proxy has no local endpoint and drops them. Without a preStop delay the Pod is already gone during that window. The fix is arithmetic: a preStop sleep of at least the interval times the unhealthy threshold plus a margin, so 25 seconds here, so the Pod is still serving when the load balancer finally stops sending. That is the same drain rule as for any load balancer in front of anything.

"How does IP-target mode preserve the client IP, and what does it change about draining?"

In IP-target mode the cloud load balancer's target group contains Pod IPs directly, which works because the CNI gave Pods routable VPC addresses. The load balancer connects straight to the Pod, no NodePort, no second hop, no source NAT, so the Pod sees the client's address in the TCP source, or in X-Forwarded-For for an application load balancer. Draining changes because the load balancer, not kube-proxy, must learn about the Pod leaving. The AWS Load Balancer Controller watches the Pod and deregisters it on deletion, and the controller's Pod readiness gate holds a new Pod as not Ready until the target is registered and healthy, so a rollout cannot outrun registration. The preStop delay is still needed because deregistration and connection draining take a few seconds.

"When is externalTrafficPolicy: Local still the right choice?"

When the load balancer cannot target Pods: an on-premises MetalLB setup, a cloud without a Pod-targeting controller, or a UDP or raw TCP service where an application-layer proxy is not an option and the source address must be preserved for the protocol itself. In those cases I make Local safe by running the workload as a DaemonSet or with a hostname spread so every node has a Pod, which makes every node a healthy target and removes the flapping; and I give it the preStop delay derived from the health-check timing. I also document why nodes without a Pod show as unhealthy, because the next person will open a ticket about it. For HTTP behind a modern cloud, IP-target mode replaces all of that.

Drill · Configuration & secrets

These questions test whether you know where each configuration value actually lives, who can read it, and how a change reaches — or fails to reach — a running process.

Q96. "Why is a Kubernetes Secret not secret by default? List what actually protects one, and compare consuming it as an environment variable versus a mounted file."

Reveal answer

Strong answer A Secret's values are base64-encoded, which is a transport encoding anyone reverses with one command, and by default they are stored in etcd exactly like a ConfigMap. What protects a Secret is a stack of controls, each optional: RBAC limiting get and list on secrets to the workloads and people who need them — list alone returns every value, a common oversight; encryption at rest configured on the API server, ideally with a KMS provider so the key lives outside the cluster; node scoping, since the kubelet only fetches a Secret to a node when a Pod there mounts it, and the node authoriser prevents a compromised node from reading others; etcd itself behind TLS and its disks encrypted; and audit logs of who read what. Consumption: as an environment variable the value is read once at container start, appears in kubectl describe pod and in any child process, and leaks into crash dumps and some logging frameworks' environment dumps. As a mounted file the value is written to a tmpfs (memory-backed) volume, updated in place within about a minute when the Secret changes (except with subPath), readable only by the container's user with defaultMode: 0400, and never visible in Pod descriptions. Files win on every axis but convenience, and Spring's configtree import makes them as convenient as environment variables.

Land it Base64 is not a lock; RBAC, encryption at rest, and file-based consumption are — and the shortest path to a leak is a role with list on secrets.

Likely follow-ups
"How do you turn on encryption at rest, and how do you verify it actually took effect?"

On a self-managed API server, an EncryptionConfiguration file passed with --encryption-provider-config lists resources, typically secrets, and providers in order: a kms v2 provider pointing at a cloud KMS plugin socket first, then identity last so old plaintext entries still read. New writes use the first provider. Existing Secrets are not rewritten until touched, so the migration step is kubectl get secrets -A -o json | kubectl replace -f -, which rewrites every one. To verify, read the raw etcd key with etcdctl get /registry/secrets/shop/orders-db; an encrypted entry starts with k8s:enc:kms:v2: instead of plaintext. On managed services, EKS envelope encryption and GKE application-layer secrets encryption are cluster settings that do the same with a customer-managed key, and the verification is the cluster's configuration plus the KMS audit log showing decrypt calls.

"Show me exactly how list on secrets leaks, and what the safe grant looks like."

RBAC's list verb returns full objects, not names, so a role with resources: ["secrets"], verbs: ["list"] lets kubectl get secrets -o yaml dump every value in scope; watch does the same as a stream. Resource names cannot restrict list either, because listing is a collection operation. The safe grant for a workload is get on named resources:

rules:
- apiGroups: [""]
  resources: ["secrets"]
  resourceNames: ["orders-db", "orders-tls"]
  verbs: ["get"]

Better still, the workload needs no Secret RBAC at all, because the kubelet mounts the Secret using the node's identity, not the Pod's ServiceAccount. Only operators that manage Secrets need list, and they get it in specific namespaces. I would scan for cluster-wide list or * on secrets weekly.

"How does a file-mounted Secret update in place, and why does subPath break it?"

The kubelet writes the Secret's keys into a tmpfs directory with a versioned subdirectory and a symlink, ..data, pointing at the current version. On each sync period, about a minute by default, or sooner with the watch-based configuration, it writes a new subdirectory and atomically swaps the symlink, so a process that re-opens the file sees the new value and never sees a half-written one. subPath mounts a single file by bind-mounting the specific path at mount time, which pins the container to the original version's inode, so the symlink swap never reaches it. The same applies to ConfigMaps. So for anything that should pick up rotation, mount the whole directory and read /etc/secrets/db-password through the symlink; Spring's configtree import does exactly that.

"Is a Secret really worse as an environment variable, or is that received wisdom?"

It is a real, if modest, difference. Environment variables are inherited by every child process, so a shell spawned by a vulnerability or a diagnostic tool sees them; they appear in /proc/<pid>/environ, which any process with the same user can read; Spring Boot's actuator env endpoint and some crash reporters will print them unless sanitised; and they cannot be rotated without a restart. Files on tmpfs are readable only by the container's user with the mode you set, are not inherited, and rotate in place. The honest counterpoint is that a process which can read its environment can usually also read its mounted files, so the attacker with code execution gets both. The gain is against accidental exposure, logs and dumps and descriptions, which is where most real leaks come from.

Q97 · Design. "Design secrets management for 200 services on Kubernetes: source of truth, delivery, rotation, and what a developer sees."

Reveal answer

Strong answer Requirements: no secret in Git, rotation without redeploys where possible, per-service least privilege, an audit trail of reads, and a developer experience that does not route through the platform team. Design: the source of truth is an external store — AWS Secrets Manager or HashiCorp Vault — with a path convention <env>/<team>/<service>/<name> and access policies per path bound to the service's workload identity. Delivery through the External Secrets Operator: each service's manifest includes an ExternalSecret naming the keys it needs, and the operator creates the Kubernetes Secret and refreshes it on an interval, so what is in Git is the reference, never the value. For the highest-sensitivity cases, the Secrets Store CSI driver mounts directly from the store with no Kubernetes Secret at all. Consumption as mounted files with Spring's configtree, so rotation flows in without a restart for anything that re-reads the file, and a checksum-triggered rolling restart for the rest. Rotation: database credentials through Vault's dynamic secrets (short-lived credentials per Pod) or the cloud's rotation Lambda, with the application's pool configured to reconnect on authentication failure. Cluster-side hardening: encryption at rest with a KMS key, RBAC that grants get on specific Secret names only to the owning ServiceAccount, no list for anyone but the operator, and an admission policy that rejects Secrets created directly by humans in production namespaces. What a developer sees: the store's UI for their own paths, a pull request adding an ExternalSecret, and the audit log. Trade-offs: the operator is a critical dependency, so it runs HA with alerts on sync failures; dynamic database credentials require application support for reconnecting. What I would not do: sealed-secrets or SOPS-encrypted values in Git as the primary mechanism for 200 services — workable at small scale, but rotation and audit become manual — and never environment-variable injection from a shared "all-secrets" object.

Land it Git holds references, the store holds values, the operator moves them, and files carry them into the process — rotation and audit then belong to the store, where they should.

Likely follow-ups
"The External Secrets Operator is down for an hour. What happens to running services and to deploys?"

Running services are unaffected, because the Kubernetes Secrets the operator created still exist and the kubelet keeps serving them; the operator is only in the path of creating and refreshing. Rotation stops: a value rotated in the store during the outage does not reach the cluster until the operator returns, so if the store's rotation also invalidates the old credential in that hour, Pods start failing authentication; that is why rotation must keep the old credential valid for longer than the operator's worst-case outage. Deploys of existing services work. A brand-new service whose ExternalSecret has never synced has no Secret, so its Pods stay in ContainerCreating with a missing-Secret event. The operator therefore runs with two replicas, a PDB, and an alert on externalsecret_status_condition not Ready for more than 10 minutes.

"How do dynamic database credentials actually work with a HikariCP pool?"

Vault's database secrets engine creates a database user with a time-to-live, say one hour, on each request. The Vault Agent sidecar or the Secrets Store CSI driver renews the lease and writes new credentials to a file before expiry. The application must notice: with HikariCP that means a custom DataSource wrapper that re-reads the credentials file when creating a connection, and a maxLifetime shorter than the credential's TTL so that every pooled connection is replaced before its user is revoked. Spring Cloud Vault does this with a lease-renewal listener that updates the pool's credentials. The failure mode is a connection created with the old user that outlives the lease and fails mid-transaction; the maxLifetime rule prevents it. The upside is that a leaked password is worthless within an hour and every credential names one Pod.

"What would you cut under time pressure for a first version?"

I would cut dynamic credentials and use static ones in the store with a scheduled rotation and a grace window. I would cut the CSI driver path and use the operator for everything. I would cut the admission rule against human-created Secrets and rely on RBAC for now. I would keep the external store as source of truth, the operator delivering references, file-based consumption, and per-service access policies, because those are the parts that are painful to retrofit later once 200 services have secrets in Git or in a shared object. The whole first version is a week: operator installed, store paths and policies created by the platform's Terraform, and one ExternalSecret per service generated by the chart from a list of key names.

"How do you audit who read a secret, end to end?"

Two logs joined. The store's audit log records every read by identity, so Vault's audit device or Secrets Manager's CloudTrail entries show that the operator's identity fetched prod/shop/orders/db at a time. Inside the cluster, the API server audit log at Metadata level for the secrets resource records every get, list, and watch with the user, and the kubelet's fetches appear as the node's identity. Both ship to the log store with a year's retention. Then a query answers "who read this secret in March": normally only the operator and the nodes running the service's Pods; any human user in that list is a finding. The gap is a human running kubectl exec and reading the mounted file, which the audit log shows as the exec, not the read, which is why exec into production is itself a logged, break-glass action.

Q98 · Scenario. "The database password was rotated in the secret store two hours ago. Half the Pods of a service now fail with authentication errors, the other half are fine. Explain the split and fix it."

Reveal answer

Strong answer Diagnosis order: a half-and-half split after a rotation means some Pods have the new value and some do not, or the reverse. Evidence: kubectl get secret orders-db -o jsonpath shows what the cluster Secret currently holds and its last-updated time from the ExternalSecret's status; compare Pod start times against the rotation time; and check whether the database still accepts the old password (many rotations keep both valid for a window; this one evidently did not). Ranked causes. One: the Secret is consumed as environment variables, so Pods started before the operator synced the new value carry the old password forever, and Pods started after have the new one — the failing half are the old Pods; a rolling restart fixes them. Two: the reverse — the operator has not synced yet because its refresh interval is long, so the old Pods still work on cached, already-authenticated connections while new Pods and any reconnecting pool fail with the old password; here forcing a sync with the operator's force-sync annotation fixes it. Three: the Secret is a mounted file but consumed with subPath, which never updates, giving the same split as case one. Fix: restart the Deployment after confirming the Secret holds the new value, and make sure HikariCP's pool re-reads credentials on reconnect if the value is file-based. Prevention: rotation procedures that keep the old credential valid for a grace period, a refreshInterval short enough for that window, file-based consumption without subPath, and a rollout triggered by the operator through a Reloader-style controller when the Secret changes.

Land it The split is Pods born before and after the new value arrived — a rotation is only safe when the old credential outlives the slowest Pod's restart.

Likely follow-ups
"You restarted the Deployment and now every Pod fails. What happened?"

The restart proved that the cluster Secret holds a value the database rejects, so the failing half were actually the new Pods, not the old ones. Either the operator synced the new password but the rotation in the store did not reach the database, for example a rotation Lambda that wrote the store but failed to run ALTER USER, or the store now holds a value with a formatting problem, a trailing newline from a shell echo is the classic. I check with kubectl get secret orders-db -o jsonpath='{.data.password}' | base64 -d | xxd | tail -1 for the newline and test the value directly with psql. The recovery is to roll the store back to the previous value, or run the missing database step, then let the operator sync and roll again. Lesson: before restarting anything, prove the new value works with a direct login.

"What refreshInterval would you set, and what does a short one cost?"

Around one to five minutes for credentials that rotate, an hour for ones that do not. Each refresh is a read against the store for every ExternalSecret; with 400 objects at one minute that is about seven reads per second, which is trivial for Vault but shows up on a cloud store's per-call bill, Secrets Manager charges per ten thousand calls, so the annual cost is small but nonzero. The real constraint is the rotation grace window: the interval plus the Reloader rollout time plus the slowest Pod's startup must be shorter than the period both credentials stay valid. If the store keeps the old password valid for an hour, five minutes is comfortable. The operator also supports a store-side push or webhook trigger in some providers, which gives near-instant sync without polling.

"How does a Reloader-style controller work, and what is the risk?"

Reloader watches Secrets and ConfigMaps and, when one changes, patches a pod template annotation on every Deployment that references it or that carries an opt-in annotation, which triggers a normal rolling update. The equivalent without a controller is a checksum annotation in the Helm template, which only triggers on Helm upgrades, not on operator-driven changes. The risk is an uncoordinated fleet-wide rollout: if a Secret is shared by 30 services, rotating it restarts 30 services at once, and if the rollout runs while the old credential is already invalid, every restarting Pod comes up healthy while every not-yet-restarted Pod fails. So shared Secrets are split per service, the rollout respects PDBs and maxUnavailable, and the rotation runbook says: rotate, watch the sync, watch the rollout, then revoke the old value.

"Design the rotation so this cannot happen again, in one sentence per step."

Step one, the store creates the new password and applies it to the database while the old one remains valid, dual-credential rotation. Step two, the operator syncs the new value within its refresh interval. Step three, services that read the mounted file pick it up on their next connection; HikariCP's maxLifetime of ten minutes bounds how long old connections persist. Step four, for services that only read at startup, the reload controller rolls them, respecting PDBs. Step five, after the grace window, an hour, the store revokes the old password. Step six, an alert on database authentication failures per service catches any Pod that missed a step. The single principle is that the old credential dies last, after every consumer has demonstrably moved.

Drill · Storage & delivery tooling

This group tests whether you can reason about a disk that lives in one zone and a manifest that lives in Git, and what each of those facts forces.

Q99. "Explain PersistentVolume, PersistentVolumeClaim, and StorageClass, the access modes, and why WaitForFirstConsumer exists."

Reveal answer

Strong answer A PersistentVolume is a cluster-scoped record of a real piece of storage — a cloud disk, an NFS export — with its capacity, access modes, and the CSI driver that manages it. A PersistentVolumeClaim is a namespaced request: size, access mode, and class. Binding matches a claim to a volume one-to-one. A StorageClass names a provisioner and parameters (disk type, IOPS, encryption) so that a claim for that class triggers dynamic provisioning — the CSI driver creates the disk and the PV for it — which is how every production cluster works; nobody creates PVs by hand except for pre-existing storage. Access modes describe what the storage supports: ReadWriteOnce means mountable read-write by one node (several Pods on that node may share it), which is what block disks give; ReadWriteOncePod, stable since 1.29, tightens it to one Pod; ReadWriteMany means many nodes at once and needs a network filesystem; ReadOnlyMany is many nodes, read-only. WaitForFirstConsumer exists because a block disk lives in one availability zone. With the default Immediate binding, the disk is created when the claim is created, in some zone, and the Pod that later uses it must then be scheduled in that zone — which may be full or excluded by the Pod's constraints, leaving the Pod Pending forever. With WaitForFirstConsumer, provisioning is delayed until the scheduler has chosen a node for the first Pod using the claim, and the disk is created in that node's zone. It should be the default on every zonal StorageClass.

Land it The claim asks, the class provisions, the volume records — and because disks have a zone, let the scheduler pick the node before the disk exists.

Likely follow-ups
"What happens to the disk when the Pod, the StatefulSet, or the PVC is deleted?"

Deleting a Pod does nothing to the PVC or the disk; the claim persists and the replacement Pod reattaches. Deleting a StatefulSet by default leaves its PVCs in place, which is why data survives a redeploy; since 1.27 the persistentVolumeClaimRetentionPolicy field can set whenDeleted or whenScaled to Delete for sets where that is wanted, such as caches. Deleting the PVC triggers the StorageClass's reclaimPolicy: Delete, the default for dynamically provisioned classes, destroys the cloud disk; Retain keeps the PV and the disk, marked Released, for manual recovery. For a database class I set Retain and add a finalizer-aware deletion process. The command that loses data is kubectl delete pvc on a Delete class, and I would put an admission rule requiring a label to permit that in production.

"How do you resize a volume, and can you shrink one?"

If the StorageClass has allowVolumeExpansion: true and the CSI driver supports it, editing the PVC's spec.resources.requests.storage upward triggers the driver to grow the cloud disk and then the kubelet to grow the filesystem; for most drivers this happens online with the Pod running, and the PVC's conditions show FileSystemResizePending then complete. Some clouds limit how often a disk can be resized, AWS EBS once every six hours. Shrinking is not supported by the API at all, because the filesystem cannot safely shrink in place under a live volume; the path is a new smaller PVC and a data copy. On a StatefulSet, the PVC is created from volumeClaimTemplates, which is immutable, so the practice is to edit each PVC individually and then update the template with the StatefulSet recreated using --cascade=orphan.

"When would you use ReadWriteMany, and what would you never put on it?"

For shared files that several Pods must read and write at once: uploaded assets served by multiple replicas, a shared model cache, a legacy application that writes to a shared directory. It requires a network filesystem, NFS, EFS, Azure Files, or a CSI driver over one, and the cost is latency of a millisecond or more per operation and no local page cache coherence guarantees beyond what NFS gives. I would never put a database, a message broker, or anything that does its own journaling on it, because those need block semantics and fsync guarantees that network filesystems do not reliably provide, and I would never use it as a substitute for object storage for large files. Where it is used, the driver's throughput mode and burst credits are part of the design.

"What does WaitForFirstConsumer not solve, and how does it interact with the autoscaler?"

It solves the disk being created in the wrong zone for the first Pod. It does not help when the Pod is later rescheduled: the disk is now pinned to that zone, and if that zone has no capacity or the node pool there is empty, the Pod stays Pending with a volume node affinity conflict. With the Cluster Autoscaler, the autoscaler understands the PV's zone affinity and scales the node group in that zone, provided there is a per-zone group; a single multi-zone group can scale in the wrong zone and leave the Pod stuck. Karpenter reads the affinity and provisions in the right zone. So for stateful sets I run per-zone node groups or Karpenter, and I keep one replica per zone so that a zone loss loses one replica, not the ability to schedule.

Q100 · Scenario. "A StatefulSet Pod was rescheduled after its node was preempted. It is stuck in ContainerCreating with 'Multi-Attach error for volume'. It has been six minutes. What is happening and what is the safe way out?"

Reveal answer

Strong answer Diagnosis order: a ReadWriteOnce disk can be attached to one node at a time, and the cloud still believes it is attached to the old node. Evidence: kubectl describe pod shows FailedAttachVolume ... Multi-Attach error for volume ... Volume is already exclusively attached to one node and can't be attached to another; kubectl get volumeattachment lists an attachment to the old node; the old Node object may still exist, or the Pod there may still be Terminating. Cause: the attach-detach controller only detaches when the old Pod is confirmed gone and the node reports the unmount; a preempted node disappeared without unmounting, so the controller waits — after six minutes it force-detaches, which is why the wait is usually just under that. Ranked contributors: the old Pod stuck Terminating because the kubelet never acknowledged; the Node object still present so the controller thinks the node may come back; a CSI driver that is slow to reconcile. Safe way out, in order: if the old node is truly gone, delete its Node object — the controller then knows the kubelet will never answer, force-detaches, and the new attach proceeds; if the old Pod is stuck Terminating, force-delete it once the node is confirmed dead. Only if the cloud side is wedged do I detach the disk in the cloud console, and only after confirming nothing is writing to it — detaching a disk under a live filesystem corrupts it. Prevention: a node termination handler on spot pools that cordons, drains, and unmounts in the two-minute warning; the cloud's node-lifecycle integration that deletes Node objects for terminated instances promptly; and a documented six-minute expectation so nobody panics and yanks disks.

Land it The disk is faithfully refusing to be in two places — tell the control plane the old node is dead, and let the detach happen in order rather than by hand.

Likely follow-ups
"Where does the six-minute number come from, and can you change it?"

It is the attach-detach controller's maxWaitForUnmountDuration, hard-coded to six minutes in the controller manager. When a Pod is deleted but the node has not reported the volume unmounted, the controller waits that long and then issues a force detach on the assumption the node is gone. It is not configurable through a flag on managed clusters, and even on self-managed it is a constant rather than a setting. The knob you do have is making the wait unnecessary: deleting the Node object tells the controller the node is gone immediately, and a termination handler that unmounts during the shutdown warning means the detach happens in order before the node dies. There is also a newer opt-in, the disable-force-detach-on-timeout flag, which stops the force detach for setups where a stale attach is safer than a possible double writer.

"You deleted the Node object and it is still stuck after ten minutes. What next?"

Then the cloud side is out of step with the controller. kubectl get volumeattachment shows whether the attachment object still points at the old node; if it does and the node object is gone, the CSI controller Pod may be unhealthy or the driver's detach call is failing, and its logs in kube-system say why, often a cloud API permission error or a rate limit. In the cloud console, check the disk's attachment state; if it says attached to an instance that no longer exists, a force detach from the cloud API is safe because there is nothing to corrupt. If the instance still exists and is running, it is not truly dead, and I stop the instance first. Only after the cloud shows the disk free do I delete the stale VolumeAttachment object, and the attach to the new node proceeds.

"How does a spot termination handler prevent this, concretely?"

The cloud gives a warning before reclaiming a spot instance, two minutes on AWS, 30 seconds on GCP. A handler, the AWS node termination handler as a DaemonSet or Karpenter's built-in interruption queue, receives that notice, cordons the node so nothing new lands, and drains it, which deletes the Pods gracefully and lets the kubelet unmount their volumes and report that to the controller. The detach then happens in the normal order while the node is still alive, and the replacement Pod attaches on a new node without any wait. It needs the Pods' terminationGracePeriodSeconds plus unmount time to fit inside the warning window, so a StatefulSet with a 90-second shutdown does not fit on GCP spot. For anything with a disk, I keep it off spot or accept the six minutes.

"Would ReadWriteOncePod have changed anything here?"

No, it would have made the guarantee stricter. ReadWriteOnce restricts attachment to one node, so two Pods on the same node may share the volume; ReadWriteOncePod restricts it to one Pod, enforced by the scheduler and the kubelet, and is the right mode for a database that must never have two writers. In this scenario the constraint is at the node attachment level and would be the same under both. Where it helps is a different failure: a rollout with maxSurge that briefly schedules a second Pod on the same node and mounts the same disk, which ReadWriteOnce allows and ReadWriteOncePod refuses. Since 1.29 it is stable, and I would make it the default access mode in the StatefulSet templates the platform chart generates.

Q101 · Scenario. "Nodes in one pool keep reporting DiskPressure and evicting Pods, even though no workload uses a PersistentVolume. Diagnose."

Reveal answer

Strong answer Diagnosis order: DiskPressure is about the node's own filesystem — the one holding container images, writable container layers, emptyDir volumes, and container logs — not about persistent volumes at all. Evidence: kubectl describe node shows the condition and the eviction events; a debug Pod on the node with df -h /var/lib/containerd /var/log/pods and du under those paths shows what is consuming space. Ranked causes. One: container logs — a service logging at debug level writes gigabytes to stdout, which the kubelet stores under /var/log/pods; the kubelet's containerLogMaxSize (10 MiB by default) and containerLogMaxFiles (5) cap each container, but a hundred chatty containers add up, and a container writing to a file inside its writable layer bypasses those caps entirely. Two: image accumulation — every deploy pulls a new 600 MiB image and garbage collection only starts at the imageGCHighThresholdPercent (85 percent), so a pool with small root disks lives near the threshold. Three: emptyDir volumes used as scratch space with no sizeLimit, or a Pod writing temporary files to its root filesystem without readOnlyRootFilesystem to stop it. Four: a runaway core dump or heap dump directory. Fixes: set resources.requests.ephemeral-storage and limits so a Pod exceeding its share is evicted alone rather than the node hitting pressure; sizeLimit on every emptyDir; read-only root filesystems; sane log levels and a log-rotation-aware logging setup; larger root disks or a separate image filesystem; and lower image GC thresholds. Prevention: a node disk usage alert at 70 percent, and ephemeral-storage requests in the platform's LimitRange defaults.

Land it DiskPressure is the node's root disk full of logs, images, and scratch — give every Pod an ephemeral-storage budget and the node stops paying for the loudest tenant.

Likely follow-ups
"How does ephemeral-storage accounting work, and what happens when a Pod exceeds its limit?"

The kubelet measures each Pod's local usage: the writable container layer, emptyDir volumes without medium: Memory, and the container logs it manages. Requests are used by the scheduler against the node's allocatable ephemeral storage, and limits are enforced by the kubelet's periodic scan, roughly every ten seconds. When a Pod's total exceeds its limit, the kubelet evicts the Pod, with an event saying which limit was exceeded, and the controller replaces it; that eviction is isolated to the offender rather than the node-wide pressure eviction that hits low-priority tenants. Because the scan is periodic, a burst can overshoot briefly. Setting requests.ephemeral-storage: 1Gi and limits: 2Gi in the LimitRange defaults gives every Pod a budget, and a chatty logger then evicts itself instead of its neighbours.

"What are the kubelet's actual eviction thresholds for disk, and what does it do at each?"

Two signals: nodefs, the filesystem holding Pod volumes and logs, and imagefs, the one holding images and writable layers, which may be the same disk. Defaults for hard eviction are nodefs.available<10%, imagefs.available<15%, and nodefs.inodesFree<5%. When a threshold is crossed, the kubelet first tries reclaiming without evicting: it deletes dead containers and then unused images down to imageGCLowThresholdPercent, 80 percent by default. If that is not enough, it evicts Pods ranked by how far their usage exceeds their request, then by priority, then by absolute usage. The node condition DiskPressure is set and stays for the evictionPressureTransitionPeriod, five minutes, during which the scheduler will not place new Pods there. Soft thresholds with a grace period can be added for earlier, gentler action.

"The fixes are in and one node still hits DiskPressure daily. What next?"

Then something on that node writes outside the accounted paths. From a node debug session, du -x -d1 / and du -d1 /var/lib find it. Candidates: a hostPath volume, which is not counted against any Pod's ephemeral storage, used by a log shipper or a monitoring agent that buffers to disk; the container runtime's own storage, snapshots left by a failed image pull, cleaned with crictl rmi --prune; journald on the node growing without a size cap; core dumps in /var/crash; or inode exhaustion rather than bytes, where df -i shows the filesystem full of tiny files, typically from a Pod creating millions of temp files. The fix follows the finding, and the node image gets the change so the next node does not inherit it.

"How would you separate the image filesystem from the node filesystem, and why?"

Give the node a second disk mounted at the container runtime's root, /var/lib/containerd, which makes imagefs a separate filesystem from nodefs. Then image pulls and writable layers cannot fill the disk that holds logs, emptyDirs, and the kubelet's own state, and vice versa; the kubelet applies separate thresholds to each and reclaims images without touching Pod data. On cloud node pools this is a node image or launch template setting, and Bottlerocket and similar images do it by default. The cost is a second disk per node, a few dollars a month. As of Aug 2026 the kubelet also supports a split image filesystem, where read-only image layers and writable layers sit on different disks, which helps nodes with very large images.

Q102 · Design. "Design a production PostgreSQL deployment inside Kubernetes for a system-of-record with a 15-minute recovery-point objective — or argue for keeping it out of the cluster."

Reveal answer

Strong answer Requirements: durability, automated failover, backups meeting a 15-minute RPO, and upgrades without data loss. If in-cluster, the only design I would sign off on uses an operator — CloudNativePG or the Crunchy or Zalando operators — because a hand-rolled StatefulSet cannot do failover safely. Design: a Cluster resource with one primary and two replicas across three zones using streaming replication, each with its own WaitForFirstConsumer PVC on zonal SSD; the operator handles promotion on primary failure, fences the old primary so it cannot accept writes after a partition, and repoints a read-write Service and a read-only Service; synchronous replication to at least one replica so a failover loses nothing; continuous WAL archiving to object storage with base backups, giving point-in-time recovery well inside the 15-minute RPO; a dedicated tainted node pool with Guaranteed QoS and no CPU limits; a PDB of one; and connection pooling through PgBouncer in front so failovers do not overwhelm the new primary with reconnections. Restore drills scheduled monthly against a scratch namespace. The honest argument for keeping it out: a managed database (RDS, Cloud SQL, Aurora) provides all of that with a support organisation behind it, and the cluster's own upgrades, node rotations, and CNI changes become risk events for the system of record if it lives inside. The in-cluster case is real only where a managed offering is unavailable or unaffordable, for many small databases where per-instance managed pricing dominates, or for dev and test environments where speed matters more than durability. For a system of record with a real RPO, I would recommend managed, and I would say so even though the in-cluster design is possible. What I would not do: a single-replica Postgres with a network disk and "the StatefulSet will restart it".

Land it In-cluster Postgres is an operator with synchronous replicas, WAL archiving, and rehearsed restores — and for a system of record the managed service is still the better answer unless you can name why it is not.

Likely follow-ups
"How does CloudNativePG fence the old primary, and what happens if it cannot?"

The operator tracks the primary through the Kubernetes API, not through the database. When it decides to promote a replica, it first marks the old primary as fenced in the cluster's status, which its instance manager sidecar reads and responds to by shutting Postgres down, and the operator repoints the read-write Service's selector to the new primary. Clients connecting through the Service can only reach the new primary. If the old node is partitioned so the instance manager never sees the fence, the old Postgres may still run, but no Service points at it, and any client holding a direct connection will fail on the next write because synchronous replication requires a replica that has now moved on. The remaining risk is a client that bypassed the Service with a Pod IP, which is why connections go through the Service or PgBouncer only.

"What does synchronous replication cost, and how do you keep it from stalling writes?"

Each commit waits for at least one replica to acknowledge the write-ahead log record, which adds a network round trip, typically under a millisecond within a zone and one to two milliseconds across zones, to every commit. Throughput of small transactions drops accordingly. The stall risk is when the synchronous replica is down: with a strict setting, commits block until it returns. The operator mitigates this with quorum-based settings, Postgres's synchronous_standby_names with ANY 1 (r1, r2), so either replica may acknowledge, and CloudNativePG's minSyncReplicas and maxSyncReplicas adjust the requirement to what is currently healthy, dropping to asynchronous if both replicas are gone rather than freezing. That degradation should page, because during it the RPO is no longer zero.

"How do you prove the 15-minute RPO, not just claim it?"

With a restore drill that measures it. WAL archiving ships segments to object storage continuously, and the operator can be configured to force a segment switch at a fixed interval, archive_timeout of five minutes, so the newest archived data is never older than five minutes even on a quiet database. The drill: insert a marker row with a timestamp, wait for the archive, destroy the cluster in a scratch namespace, restore from the latest base backup plus WAL with point-in-time recovery to "now", and check the marker row is present. The gap between the marker's timestamp and the recovery point is the measured RPO. I would run it monthly and record the number; a design with an archive_timeout of five minutes and a healthy archive gives a measured RPO of about five minutes, inside the target with margin.

"The requirement changes to 40 small databases for 40 services. Does that change your recommendation?"

Yes, that is the case where in-cluster wins on cost. Forty managed instances each carry a fixed floor price and a fixed operational identity, and most of them will be tiny. Forty CloudNativePG clusters on a dedicated pool, each with a primary and one replica, share nodes and share one operator, and the per-database cost is a few hundred millicores and a small disk. The operator makes the number manageable because every cluster has the same backup, failover, and upgrade behaviour from one template in the platform chart. What I would keep: the same WAL archiving to object storage for each, restore drills sampled across them, and a rule that any database that grows past a threshold, say 200 GB or a defined transaction rate, is reviewed for a move to managed. The system of record stays managed regardless.

Q103 · Design. "Design the packaging for 80 internal Spring Boot services: Helm, Kustomize, or both, and how you keep every service's probes, resources, and security context correct without visiting 80 repositories."

Reveal answer

Strong answer Requirements: one opinionated shape for every service, per-service knobs kept small, changes to the shape propagating without 80 pull requests, and manifests that remain readable. Design: a single internal Helm library chart, spring-service, versioned and published to an OCI registry, that renders a Deployment with the reference probes, resource pattern, security context, PDB, Service, HTTPRoute, ServiceAccount, and NetworkPolicy baseline from a values file of perhaps 20 fields — image, port, replicas or HPA bounds, memory size, dependencies for the egress policy, hostnames. Each service repository holds only a values.yaml and a chart reference; the environment repository holds per-environment values overlays. Because the shape lives in one chart, fixing a probe timeout or adding a spread constraint is one chart release plus a version bump rolled out by the GitOps agent through an ApplicationSet — a controlled propagation, with a canary set of services first. Kustomize is used where Helm's templating is the wrong tool: environment-specific patches on top of the rendered chart, and for third-party manifests. Guard rails so the chart cannot be bypassed: admission policies that require the platform labels and the security baseline, so a hand-written Deployment is rejected; chart unit tests with helm unittest; schema validation of values through values.schema.json. Trade-offs: a shared chart is a shared blast radius, so its releases are versioned and services pin a version rather than floating; escape hatches (raw extra manifests, patches) exist but are reviewed. What I would not do: copy-paste a starter chart into 80 repositories, which is how every fleet ends up with 80 different probe configurations, or template YAML with a general-purpose text templating language outside Helm.

Land it One versioned library chart, a 20-field values file per service, and admission rules that make the chart the only way in — the shape is fixed in one place because that is the only place you will ever fix it.

Likely follow-ups
"How does a chart change actually reach 80 services, and how do you canary it?"

The chart is published to the OCI registry as spring-service:2.14.0. Each service's environment directory pins a version in its Chart.yaml dependency or in the ApplicationSet's template. A platform bot opens pull requests bumping the version, first to a canary group, perhaps five internal services in each team, and their Argo Applications sync and roll. After 48 hours of clean metrics the bot opens the rest in batches of 20 with a delay between batches. Services pin, so nobody gets a chart change they did not merge, and a service can lag for a sprint if it needs to. What stops a service lagging forever is a policy: chart versions older than two minors fail a warning check in CI, and older than four block deploys, so the fleet stays within a known window.

"What goes in the values file, and what should never be there?"

What goes in: image repository and tag, container port, memory size expressed as one number the chart turns into request and limit, replica bounds for the HPA, the list of dependencies by namespace and service for the egress policy, hostnames for the HTTPRoute, environment variables that are not secrets, and the names of ExternalSecret keys. Roughly 20 fields. What should never be there: the full securityContext, probe paths and timings, spread constraints, PDB settings, labels, or anything that the platform needs to be identical across the fleet, because a field in values is a field someone will change. The chart's values.schema.json enforces this by using additionalProperties: false, so an unknown key fails rendering rather than silently doing nothing, which is the most common Helm mistake.

"Where does Kustomize fit, and why not Kustomize alone?"

Kustomize composes and patches plain YAML: a base and overlays per environment, with strategic merge patches and JSON patches, no templating. It is excellent for environment differences on top of rendered output and for third-party manifests you do not own. Alone, for 80 services, it means each service has its own base copied from a starter, and a fleet-wide change becomes 80 patches or a components mechanism that becomes its own templating language. Helm's library chart centralises the shape with real parameters and a schema, which Kustomize cannot express. So the practical combination is Helm to render the service from the library chart, Argo's Helm-then-Kustomize support or a rendered-manifests pipeline to apply environment overlays, and Kustomize alone for things like the monitoring stack's upstream manifests.

"A team says the chart cannot express their case and wants to write raw manifests. What do you do?"

First I ask what the case is, because nine times out of ten it is a missing chart feature that three other teams also need, an init container, an extra volume, a second port, and the answer is a chart release next week. For the genuine exception, the chart has an extraManifests list and a strategic merge patch hook so the team can add or modify within the chart's output while still getting the baseline. If even that does not fit, the raw manifest path exists, but the admission policies still apply, so it must carry the labels, the security context, and the resource pattern, and it is registered in a platform list with an owner and a review date. What I refuse is a bypass that removes the admission checks, because that is how the fleet gets its eighty-first shape.

Q104 · Design. "Design the GitOps repository layout and promotion flow for 12 teams across dev, staging, and production, with Argo CD."

Reveal answer

Strong answer Requirements: teams deploy their own services without touching each other, production changes are reviewed and traceable, promotion between environments is a Git operation, and the platform can change the shape of everything centrally. Design: separate application repositories (code, Dockerfile, chart values defaults) from a small number of environment repositories — one per environment, or one repository with a directory per environment, with production having stricter branch protection. Each environment repository holds, per team, per service, a directory with the chart version and the values for that environment; the image tag lives here, not in the application repository. CI builds and pushes an image, then opens or auto-merges a commit in the dev environment repository updating the tag; promotion to staging and production is a pull request that copies the tag forward, created by a bot and approved by the team for staging and by the team plus a reviewer for production. Argo CD runs one instance per environment (or a central one with cluster credentials, for smaller estates), with an ApplicationSet using a Git directory generator so every service directory becomes an Application automatically — no platform ticket to onboard a service. Argo Projects per team restrict which namespaces and repositories each team's Applications may target, and which cluster resources they may create, so a team cannot deploy into another team's namespace. Auto-sync with self-heal in dev and staging; in production, auto-sync with a sync window that blocks deploys outside business hours except through a break-glass label. Secrets are references only. Trade-offs: the two-repository split adds a hop but removes the anti-pattern of the CI pipeline pushing to the cluster; a single environment repository is simpler but concentrates production access. What I would not do: Argo Applications hand-created per service, CI with cluster credentials, or the image tag stored in the application repository where a code change and a deploy are the same commit.

Land it Code repositories build images, environment repositories name tags, ApplicationSets discover services, and Projects fence teams — promotion becomes a pull request that anyone can read.

Likely follow-ups
"How does the image tag get into the dev environment repository without CI holding cluster credentials?"

CI has Git credentials for the environment repository, not cluster credentials. After the image push, the pipeline runs a small step that clones the environment repository, updates the tag in dev/shop/orders/values.yaml, and commits directly on the dev branch, or opens an auto-merging pull request; Argo CD sees the commit and syncs. The alternative is Argo CD Image Updater, which watches the registry and writes the tag into Git itself, so CI does not even need the Git write. Either way, the only identity that can change the cluster is Argo CD's, and every change to it is a Git commit with an author. The tag should be a digest or an immutable tag like sha-1a2b3c4, never latest, so that the Git history names an exact image.

"Why one Argo instance per environment rather than one central one?"

Blast radius and credentials. A central Argo CD holds admin credentials for every cluster, including production, so a compromise of the dev tooling, or a mistake in a dev Project, has a path to production; and an outage or upgrade of that one instance freezes deploys everywhere. Per-environment instances mean the production Argo CD lives in the production cluster with only in-cluster credentials, its access is the production access policy, and the dev instance can be upgraded first as the canary for the tooling itself. The cost is three instances to run and three UIs to look at, which is why for a small estate one central instance with strict Projects is acceptable. As of Aug 2026 the hub-and-spoke agent model in Argo CD, where a lightweight agent in each cluster pulls from a central control plane, is the middle path many platforms are moving to.

"How does a rollback work in this flow, and how fast is it?"

A rollback is a Git revert of the promotion commit in the environment repository, which Argo syncs within its polling interval, three minutes by default, or seconds with a webhook from the Git host. Because the previous image tag is still in the registry and the previous ReplicaSet is still retained by the Deployment, the rollout back is as fast as the Pods start, a minute or two for a JVM. For an emergency, an operator can run argocd app rollback or kubectl rollout undo directly, but self-heal will then revert that within minutes to match Git, so the Git revert must follow immediately, and the runbook says so. The audit trail is complete either way: who promoted, who reverted, and when.

"What would you change if the twelve teams grew to fifty?"

The directory-per-service layout scales, but a single environment repository becomes a contention point: fifty teams merging into one production branch means queued pull requests and a very busy Argo CD repository server. I would split the environment repository per team, still with the same structure, and let the ApplicationSet use a Git generator across a list of repositories or a SCM provider generator that discovers them. I would move to the Argo CD agent model so the control plane scales independently of the clusters. And I would automate the promotion pull request policy with a tool like Kargo, which models stages and promotions explicitly, so that "staging must pass for 24 hours before production" is a rule rather than a convention.

Q105 · Scenario. "An Argo CD application has shown OutOfSync for weeks. Every sync 'succeeds', and a minute later it is OutOfSync again. Nothing is actually wrong with the service. Find the cause."

Reveal answer

Strong answer Diagnosis order: a persistent diff that a sync does not clear means something in the cluster rewrites the object after Argo applies it. Evidence: Argo's diff view shows exactly which fields differ — that is the whole answer, and it is the first thing to open. Ranked causes. One: a mutating admission webhook adds fields Git does not have — a mesh injecting a sidecar, a policy engine adding default resources or a security context, a cloud controller adding annotations — so the live object always differs from the manifest. Two: another controller owns a field: the HPA writes replicas, the VPA writes requests, cert-manager rewrites a Secret, or a CRD's controller normalises its own spec. Three: a formatting difference — a quantity written as 1000m in Git and stored as 1, or a defaulted field the API server fills in. Four, rarer: two Applications managing the same object, each reverting the other. Fix: for controller-owned fields, add ignoreDifferences for that JSON path (Argo has built-in knowledge of the HPA replicas case with RespectIgnoreDifferences); for webhook injections, either ignore the injected path or put the equivalent into the manifest so Git matches; for normalisation, write the value the way the server stores it; and enable server-side apply in Argo's sync options so field ownership resolves the shared-object case. Prevention: every platform-level mutating webhook comes with a documented Argo ignore rule, and an alert on Applications OutOfSync for more than a day so this does not sit for weeks.

Land it Perpetual OutOfSync is another writer on the same object — the diff names the field, and ignoreDifferences or server-side apply tells Argo whose field it is.

Likely follow-ups
"You added ignoreDifferences for replicas and it is still OutOfSync. What next?"

Then the diff is on another field, or the ignore rule does not match. I open the diff view again and read the actual JSON path; a common miss is that the rule targets /spec/replicas on the Deployment but the diff is on a Rollout, or the rule is in the wrong Application. Then I check whether the difference is a mutating webhook adding an annotation or a sidecar, which needs a rule for that path, or a defaulted field like imagePullPolicy that Git omits, where the fix is to write it explicitly in Git. If the diff view shows no difference and the status is still OutOfSync, it is usually a resource that Argo tracks but cannot compare, a hook resource or a resource with a missing tracking annotation, and enabling RespectIgnoreDifferences=true in sync options plus server-side diff usually resolves it.

"What does server-side apply change for Argo, and are there downsides?"

With client-side apply, Argo computes a three-way merge using the last-applied annotation and sends the full object, so any field another controller wrote is overwritten on every sync and reappears as a diff. With server-side apply, Argo sends only the fields it manages, the API server records Argo as the manager of those fields in managedFields, and other managers, the HPA on replicas, the VPA on requests, keep theirs; the diff logic can then ignore fields Argo does not own. It also removes the 256 KiB annotation size limit that breaks large CRDs. Downsides: conflicts become explicit errors when two managers claim one field, which needs force or a decision about ownership; and some older CRDs with badly defined schemas merge lists unexpectedly. I enable it per Application, starting with the ones that have controller-managed fields.

"How would you find every Application in this state across 12 teams?"

From Argo CD's metrics. argocd_app_info carries a sync_status label, so a query for argocd_app_info{sync_status="OutOfSync"} lists them, and an alert on that being non-zero for more than 24 hours for the same application catches the perpetual ones without the noise of a normal deploy. For the reason, argocd app diff in a loop over the list exports the diffs, and grouping by the differing path reveals the fleet-wide causes: if 40 Applications differ on the same injected annotation, one platform-level ignore rule in the ApplicationSet template fixes all of them. I would put that ignore rule into the ApplicationSet template rather than into each Application, so new services inherit it.

"Is it ever right to leave an Application OutOfSync?"

Only temporarily and only deliberately. A manual hotfix applied with kubectl during an incident makes the Application OutOfSync until the fix is committed, and that is the correct signal; self-heal would revert the hotfix, so during an incident an operator may pause auto-sync for that Application. Leaving it that way for weeks is wrong because the status becomes noise and a real drift then goes unnoticed. The permanent answer to "this field is expected to differ" is an ignore rule, and the permanent answer to "this object is not managed by Git" is to remove it from the Application. My rule: OutOfSync longer than a day is either a bug in the diff configuration or an uncommitted change, and both get a ticket.

Drill · Access control & security baseline

These questions test whether you can say what a compromised Pod can reach, and whether you know which control stops it at each layer.

Q106. "Explain the four RBAC objects, why there is no deny rule, and the three verbs that let a role grant more than it has."

Reveal answer

Strong answer A Role lists rules — API groups, resources, optional resource names, and verbs — that apply within one namespace. A ClusterRole has the same shape but is cluster-scoped: it can cover cluster-scoped resources like nodes and namespaces, non-resource URLs like /healthz, and can also be bound within a namespace as a reusable template. A RoleBinding grants a Role or a ClusterRole to subjects — users, groups, ServiceAccounts — within one namespace. A ClusterRoleBinding grants a ClusterRole across the whole cluster. Authorisation is a union: if any binding grants the verb, it is allowed. There is no deny rule because the model is deliberately simple — allow lists only, no ordering, no precedence — so the answer to "what can this identity do" is a straightforward enumeration (kubectl auth can-i --list --as), and removing a binding can never accidentally open access. The cost is that you cannot carve exceptions; you narrow the grant instead, with resource names or by splitting namespaces. The three dangerous verbs: escalate lets a subject create or update a Role with permissions the subject does not itself hold — without it, RBAC refuses that; bind lets a subject create a binding to a Role it does not hold; impersonate lets a subject act as another user, group, or ServiceAccount, which is effectively that identity's full power. Any role that grants create on roles or rolebindings, or these verbs, or * on anything, is an admin role whatever its name says.

Land it RBAC is allow-only and additive by design — the question is never "who is denied" but "what is the union", and escalate, bind, and impersonate are admin in disguise.

Likely follow-ups
"Show me how escalate works with a concrete example of what is refused and what is allowed."

Suppose my identity has a Role granting get and list on pods, and also create and update on roles. If I try to create a Role that grants delete on secrets, the API server refuses with a forbidden error saying I am attempting to grant permissions I do not hold, because the RBAC authoriser checks that every rule in the new Role is covered by my own permissions. If my Role additionally has verbs: ["escalate"] on roles, the same request succeeds; the check is skipped. The same applies to bind for bindings: without it, I can only bind Roles whose rules I already hold. So a "role manager" role that lets a team lead create roles in their namespace is safe only because of that check, and adding escalate to it silently makes them namespace admin.

"How do you audit what an identity can actually do, including through groups and ServiceAccounts?"

kubectl auth can-i --list --as=jane@example.com --as-group=developers enumerates the union for that user in the current namespace, and I repeat per namespace and with -A semantics in a script. The gap is that I must supply the groups, because the API server learns them from the identity provider's token, not from any stored object; so the audit starts from the identity provider's group membership. For ServiceAccounts, --as=system:serviceaccount:shop:orders. Tools like rbac-tool or kubectl-who-can invert the question: who can list secrets in production. I would run that inversion weekly for a fixed list of dangerous permissions: secrets list, pods/exec, impersonate, escalate, bind, and *, and diff the result against last week.

"Since there is no deny, how do you express 'everything except secrets' without enumerating every resource?"

Two techniques. First, aggregated ClusterRoles: the built-in view role is assembled from any ClusterRole labelled rbac.authorization.k8s.io/aggregate-to-view: "true", and it deliberately excludes secrets; so binding view gives the read-only-except-secrets result without listing resources, and custom resources join it by adding the label to their own ClusterRole. Second, for cases aggregation cannot express, a ValidatingAdmissionPolicy on Role and ClusterRole objects rejects rules that include secrets or the wildcard unless the object carries a platform-approved annotation; that is a deny at admission time rather than at authorisation time, which is the only place Kubernetes lets you say no. Enumeration with kubectl api-resources generating the list is the fallback and needs regenerating when CRDs are added.

"What about impersonation in practice: who legitimately needs it and how do you contain it?"

Legitimate uses are narrow: a platform proxy like Argo CD's or Backstage's Kubernetes plugin that acts on behalf of the logged-in user so that RBAC applies to the human, not the tool; and an operator's auth can-i audit script. Both need impersonate on users and groups, and that grant is equivalent to being any user, so it is contained by restricting resourceNames to specific users where possible, by binding it only to a dedicated ServiceAccount that runs nothing else, by logging every impersonated request, which the audit log records with both the original and impersonated identity, and by alerting on impersonation of any admin group. The one thing I refuse is impersonate granted to a human's day-to-day identity for convenience.

Q107 · Scenario. "An audit found that a junior developer's identity could read every Secret in production. Nobody granted that on purpose. Trace how it happened and fix it without breaking anyone."

Reveal answer

Strong answer Diagnosis order: first prove the finding and trace the path. kubectl auth can-i list secrets -A --as=jane@example.com confirms it; then find which bindings include her, directly or through a group: kubectl get clusterrolebindings,rolebindings -A -o json filtered for her user and her groups, and the ClusterRoles they reference. Ranked ways this happens. One: a ClusterRoleBinding of the built-in view or a custom "read-only" ClusterRole to a broad group like developers — view excludes secrets, but a home-made read-only role often says resources: ["*"] with get, list, watch, and * includes secrets. Two: an edit binding at cluster scope, which includes secrets. Three: a binding to a ServiceAccount whose token she can read or impersonate. Four: an aggregated ClusterRole that picked up a rule through a label. The fix without breaking anyone: create a replacement ClusterRole that enumerates the resources the read-only role should cover, explicitly excluding secrets (and tokens, and anything else sensitive), bind it to the same group, verify with auth can-i --list for a sample of users and pipelines that everything they use still works, then remove the old binding. Anything that legitimately needed secret access — a CI pipeline, an operator — gets a namespaced Role with resource names. Prevention: an admission policy or a periodic scan that rejects rules granting * resources or list on secrets outside a known allow-list of ServiceAccounts, and treating RBAC like code with review and tests.

Land it The asterisk in a "read-only" role is how everyone gets secrets — enumerate resources explicitly, and let a policy reject the wildcard before the next audit finds it.

Likely follow-ups
"You removed the wildcard binding and now the CI pipeline fails to deploy. What next?"

The pipeline was depending on the broad role, probably without anyone knowing. The failure message from the API server names the verb and resource that was refused, and the audit log shows exactly which identity attempted it. That is the list of permissions the pipeline actually uses. I create a namespaced Role for the pipeline's ServiceAccount with those permissions, resource-named where it touches Secrets, bind it, and re-run. The lesson for the change process is that I should have replayed the audit log first: a week of audit entries for every subject bound to the old role, grouped by verb and resource, tells me the real usage before I cut anything, and lets me build the replacement roles from evidence rather than from guesses.

"How would you build the replacement read-only role so it does not drift as CRDs are added?"

By aggregation. Create a ClusterRole platform-view with the aggregation rule selecting the label platform.example.com/aggregate-to-view: "true", and label the built-in view role's constituent rules plus a small ClusterRole per CRD family the platform installs. When the platform adds an operator, its chart ships a ClusterRole with that label, and the read-only role picks it up automatically. Secrets never get the label. An admission policy on ClusterRoles rejects any object carrying the label that mentions secrets or the wildcard, so a team cannot use the label to smuggle access in. That gives a role that grows correctly and cannot grow wrongly, and the audit question becomes "which ClusterRoles carry the label", which is one command.

"How did the developer's group end up in a cluster-wide binding, and how do you stop it recurring?"

Usually someone needed read access "everywhere" for a dashboard, wrote a ClusterRoleBinding to the developers group because a per-namespace RoleBinding for 40 namespaces was tedious, and used a home-made role with wildcards because enumerating resources was also tedious. Both shortcuts are understandable, and both are the finding. Prevention: RBAC objects live in the platform's GitOps repository and are applied only by Argo, with an admission policy that rejects Role, ClusterRole, and binding objects not created by the Argo identity; a review rule that any ClusterRoleBinding to a group needs two approvals; the tedious per-namespace bindings generated by the namespace template so they are not tedious; and the weekly "who can list secrets" report mailed to the security channel.

"Is read access to Secrets in production ever appropriate for a human?"

Rarely and never standing. The cases are debugging a rotation problem or verifying an integration, and both are served by a break-glass path: a just-in-time elevation through the identity provider that grants a time-boxed group membership with an approval, logged, expiring in an hour. Even then, the better tool is reading the secret from the external store's UI, where the audit is native, rather than from the cluster. What I would not accept is the argument that developers need it for local testing; that is what dev environment secrets and the store's own path-scoped access are for. Making the standing answer "no" is what makes the audit finding above a clear bug rather than a judgement call.

Q108 · Design. "Design how Pods obtain cloud credentials to call S3 or a managed queue — no static keys anywhere."

Reveal answer

Strong answer Requirements: per-workload identity, short-lived credentials, no key material in Secrets or images, and an audit trail that names the workload. Design: workload identity federation, which is the same design on every cloud. The cluster's API server acts as an OpenID Connect issuer for ServiceAccount tokens: a Pod receives a projected ServiceAccount token — short-lived, bound to that Pod, with an audience claim naming the cloud's token service. The cloud IAM is configured to trust the cluster's issuer, and an IAM role (or GCP service account, or Azure managed identity) carries a trust policy saying "the ServiceAccount orders in namespace shop of cluster X may assume me". The cloud SDK inside the Pod, with no code changes, finds the token file and the role from environment variables injected by a webhook (EKS Pod Identity or IRSA, GKE Workload Identity, Azure Workload Identity), exchanges the token for temporary cloud credentials that last an hour, and refreshes automatically. In the manifest that is one annotation on the ServiceAccount naming the role, and automountServiceAccountToken may stay off because the projected token is a separate volume with its own audience. Least privilege lives in the cloud role's policy — this bucket, these queue actions — one role per workload, created by the same Terraform or Crossplane definition that creates the bucket. Trade-offs: the trust is per cluster issuer, so a new cluster needs the trust re-established; and the token's audience must match or the exchange fails, which is a common first-time error. What I would not do: a Secret with an access key rotated by a cron job, a node instance role shared by every Pod on the node (any Pod can then reach any cloud resource the node can), or a single "app" role for all services.

Land it The Pod proves who it is with a token the API server signs, the cloud trusts the issuer, and the credential lives an hour — there is no key because there is no need for one.

Likely follow-ups
"Walk me through the token exchange: what is in the token and who verifies it?"

The kubelet requests a token from the API server's TokenRequest API for the Pod's ServiceAccount, with the audience the cloud expects, for example sts.amazonaws.com, and an expiry of an hour or so, and writes it to a projected volume path such as /var/run/secrets/eks.amazonaws.com/serviceaccount/token. It is a JWT signed by the cluster's ServiceAccount signing key, with claims for the issuer URL, the subject system:serviceaccount:shop:orders, the audience, the expiry, and bound Pod information. The cloud's token service fetches the cluster's OIDC discovery document and public keys from the issuer URL, verifies the signature, and checks that the subject matches the role's trust policy condition. It then returns temporary cloud credentials. Nothing secret leaves the cluster; only a signed assertion of identity.

"The exchange fails with 'not authorized to perform sts:AssumeRoleWithWebIdentity'. Diagnose."

That error means the token verified but the trust policy rejected the subject, or the audience mismatched. In order: decode the token from the Pod with cat token | cut -d. -f2 | base64 -d and read the sub and aud claims; compare them character for character with the role's trust policy condition, which must name the exact namespace and ServiceAccount, and check for a typo in the ServiceAccount annotation naming the role ARN. Then confirm the cluster's OIDC provider is registered in IAM with the right issuer URL and thumbprint, which is the step most often missed for a new cluster. Then check the audience in the projected volume's audience field matches what the trust policy expects. If all match, the role's own permission boundary or an SCP may forbid the assume.

"What is the difference between IRSA and EKS Pod Identity, and which would you pick?"

IRSA, IAM Roles for Service Accounts, is the OIDC federation described above: the cluster is an OIDC provider, each role's trust policy names the ServiceAccount, and the SDK does the exchange. EKS Pod Identity, introduced in late 2023, replaces the per-cluster OIDC registration with an agent DaemonSet and an association object created through the EKS API, so the trust policy is the same for every cluster and role reuse across clusters becomes simple; the SDK talks to a link-local endpoint on the node instead of exchanging a token itself. As of Aug 2026 I would pick Pod Identity for new EKS clusters because it removes the per-cluster trust setup and the audience errors, and keep IRSA where a workload runs outside EKS or needs cross-account roles that Pod Identity does not yet cover.

"How do you stop a Pod using the node's instance role as a fallback?"

The SDK's credential chain tries the web identity token first, but if that fails it falls through to the instance metadata service, and any Pod on the node can reach that by default, which gives every Pod the node role's permissions, typically image pulls and autoscaling calls. Block it: on AWS, enforce IMDSv2 with a hop limit of 1 in the launch template so containers cannot reach the metadata endpoint through the extra network hop, or use the VPC CNI's option to block Pod access; on GKE, Workload Identity does this by intercepting the metadata server. Then keep the node role minimal so that even a leak is small. And verify from inside a Pod that curl 169.254.169.254 fails; that is a check I would put in the cluster's conformance test suite.

Q109. "What do the three Pod Security Standards require, how is enforcement configured, and how do you move a namespace from privileged to restricted without an outage?"

Reveal answer

Strong answer The standards are three profiles. Privileged allows everything — for system components like the CNI. Baseline forbids the known escalation paths: privileged containers, host namespaces (network, PID, IPC), host ports outside a range, hostPath volumes, dangerous capabilities beyond a default set, and custom seccomp or AppArmor overrides that weaken defaults. Restricted additionally requires runAsNonRoot, allowPrivilegeEscalation: false, dropping all capabilities (with NET_BIND_SERVICE the only permitted add-back), a seccomp profile of RuntimeDefault or Localhost, and volume types limited to the safe list. Enforcement is Pod Security Admission, built into the API server since 1.25 when PodSecurityPolicy was removed, configured by labels on the namespace: pod-security.kubernetes.io/enforce, audit, and warn, each set to a profile and optionally a version. Enforce rejects non-compliant Pods; audit records violations in the audit log; warn returns a warning to the client. Migration without an outage uses those three modes: set warn=restricted and audit=restricted while enforce stays at the current level, collect violations from the audit log for a week, fix each workload's manifest (usually a securityContext block and an emptyDir for the paths the app writes), verify with kubectl label --dry-run=server which reports what would be rejected, then flip enforce. Existing Pods are never evicted by enforcement — only new Pods are checked — so the flip itself cannot cause an outage, but the next rollout of an unfixed workload will fail, which is why the audit week matters.

Land it Warn and audit first, fix what they name, then enforce — and remember that enforcement gates new Pods, so the risk lands on the next deploy, not on the label change.

Likely follow-ups
"What are the most common violations you find when moving a Spring Boot fleet to restricted, and the fix for each?"

Four appear in nearly every fleet. Missing runAsNonRoot, fixed by setting it with a runAsUser such as 10001 in the securityContext and making sure the image's user matches. Missing allowPrivilegeEscalation: false, a pure manifest change. Capabilities not dropped, fixed with capabilities.drop: ["ALL"], and if the service binds port 80, either move it above 1024 or add back NET_BIND_SERVICE. Missing seccomp, fixed with seccompProfile.type: RuntimeDefault. Then the one that needs code or image attention: writes to the root filesystem, which restricted does not require to be read-only but the platform baseline does; the fix is an emptyDir at /tmp and -Djava.io.tmpdir pointed at it. The platform chart sets all of these, so the migration is largely moving services onto the chart.

"How exactly do you run the dry run and read the result?"

kubectl label --dry-run=server --overwrite ns shop pod-security.kubernetes.io/enforce=restricted asks the API server to evaluate the label change without applying it, and the response includes a warning line per existing Pod that would violate the profile, naming the Pod and the specific check, for example "allowPrivilegeEscalation != false" or "unrestricted capabilities". That is the to-do list. I capture the output for every namespace with a loop and turn it into tickets per owning team from the namespace's owner label. The dry run reads current Pods, so a workload that is scaled to zero at the time is missed; the audit mode running for a week covers that, since it logs violations at admission for every Pod created in the period.

"Which workloads legitimately cannot be restricted, and what do you do with them?"

Cluster plumbing: the CNI agent needs host networking and NET_ADMIN; the CSI node driver needs privileged mounts; log shippers need hostPath to read /var/log/pods; the node exporter reads host /proc; and a runtime security sensor needs eBPF. Those live in kube-system or a dedicated infra-privileged namespace labelled privileged, owned by the platform team only, with RBAC that prevents anyone else deploying there, and with supply-chain controls on those images because they are the highest-value targets. Application namespaces never get an exemption; a service that "needs" privilege usually needs a design change, such as a sidecar replaced by a platform DaemonSet. The exemption list is documented, short, and reviewed quarterly.

"What does Pod Security Admission not check, and how do you cover that?"

It checks only the fields the three profiles define on the Pod spec. It does not enforce image provenance, resource requests, labels, probes, hostname ownership, or anything about non-Pod objects. It cannot express exemptions per Pod, only per namespace, user, or runtime class through the admission configuration file. And it does not validate mutating changes that come after it, though that is rare. For everything else, a ValidatingAdmissionPolicy in CEL or Kyverno: require requests and limits, require the registry prefix, forbid latest, require the owner label, forbid hostPort outside the allowed set. The way I frame it is that Pod Security Admission is the free, built-in floor, and the policy engine is where the organisation's own rules live.

Q110 · Design. "Design multi-tenancy for a shared cluster with 12 internal teams: namespaces, RBAC, quotas, network, and what a team can and cannot do to another."

Reveal answer

Strong answer Requirements: teams cannot see or affect each other's workloads, secrets, or capacity; the platform can enforce a baseline; and teams self-serve within their space. Design, per team: a set of namespaces (team-a-dev, team-a-prod) created from a template by a namespace provisioner — the Hierarchical Namespace Controller, Capsule, or a simple GitOps directory — that stamps every namespace with: Pod Security Admission labels at restricted; a default-deny NetworkPolicy plus DNS egress and an allow from the shared gateway; a ResourceQuota sized to the team's budget for requests, limits, Pods, LoadBalancers, and PVC storage; a LimitRange with default requests and a maximum per container; RBAC binding the team's directory group to a namespaced team-developer role (no secrets list, no RBAC verbs) and the team's GitOps Application to a deployer role; and a team-scoped PriorityClass ladder so they cannot preempt others. Cluster-level: an admission policy that requires the platform labels, forbids cross-namespace references in routes and policies except the shared gateway, rejects wildcard RBAC, and pins image registries; cluster-wide AdminNetworkPolicies that teams cannot override. Node isolation is optional: a team with a special need (GPU, PCI) gets a tainted pool; the rest share nodes. What a team can do to another: nothing by design — it cannot read the other's namespace, reach its Pods, or consume its quota; it can, however, degrade shared components (CoreDNS, the gateway) with abusive traffic, which is why those run on a system pool with their own capacity and rate limits, and why noisy-neighbour effects on shared nodes are mitigated by requests, not eliminated. Trade-offs: soft tenancy shares a kernel, so a container escape crosses teams; that is acceptable for internal teams and not for untrusted tenants, who get separate clusters. What I would not do: a namespace per team without quotas (one team's HPA fills the cluster), cluster-scoped roles for convenience, or letting teams create CRDs or webhooks.

Land it A tenant is a namespace template — security labels, network baseline, quota, limit range, and group-scoped RBAC stamped together — and the cluster-scoped rules are the part no tenant can edit.

Likely follow-ups
"Requirement change: two of the twelve teams are external contractors. What changes?"

They move from soft tenancy toward hard boundaries. Shared kernel is the issue: a container escape from their namespace lands on a node also running internal workloads. So their namespaces get a dedicated tainted node pool, enforced by an admission policy that adds the node selector and toleration to their Pods so they cannot opt out. Their RBAC group gets no access to shared infra namespaces at all, their egress policy allows only their declared dependencies and no cluster-internal services beyond the gateway, their image registry is a separate project scanned on push, and their Argo Project forbids cluster-scoped resources. If the contractors are truly untrusted, a separate small cluster is the honest answer, and I would price it. What does not change is the namespace template, because the same stamps apply with stricter values.

"How do ResourceQuota and LimitRange interact, and what is the first thing that goes wrong?"

A ResourceQuota that includes requests.cpu or limits.memory makes every Pod in the namespace required to declare those fields, otherwise admission rejects the Pod with a quota error; that is the first thing that goes wrong, usually for a Job or a debug Pod someone creates by hand. The LimitRange fixes it by injecting default requests and limits into any container that omits them, so the two are always deployed together. The LimitRange also sets per-container maximums and a max limit-to-request ratio, which stops a team padding requests. The quota also counts object counts, Pods, Services, PVCs, and LoadBalancer Services, which is how you stop a team creating twenty cloud load balancers. And a quota for a PriorityClass scope stops teams using the platform's high-priority classes.

"How does a team get more quota, and how do you keep that from being a platform ticket?"

The quota is a file in the team's directory of the platform GitOps repository, and a pull request raising it is approved by the platform team against a capacity dashboard. That is a ticket in the sense of a review, but it is a same-day merge, not a form. To make it self-service within limits, the ApplicationSet template can allow a team to set its quota up to a ceiling defined per team in a parameters ConfigMap, with a CEL admission policy checking the requested quota against the ceiling; above the ceiling, the pull request needs the platform team. The capacity dashboard shows each team's quota versus actual requests versus usage, so the review is a glance. And the cluster's own headroom alert tells the platform team when the sum of quotas exceeds what the autoscaler can deliver.

"What would you cut under time pressure to onboard the first three teams next week?"

I would cut the namespace provisioner and create the namespaces from a Kustomize template by hand in the GitOps repository, since three teams is nine files. I would cut per-team PriorityClasses and give everyone the default. I would cut the AdminNetworkPolicy layer and rely on the namespace baseline for now. I would keep Pod Security Admission labels at restricted from day one, because loosening later is easy and tightening later is the migration project described earlier; the default-deny plus DNS baseline; a ResourceQuota and LimitRange even if generous; and the group-scoped RBAC. Those four take an afternoon and they are the ones whose absence produces a cross-team incident.

Q111. "Compare admission webhooks with ValidatingAdmissionPolicy in CEL. What changed, and when do you still need a webhook?"

Reveal answer

Strong answer An admission webhook is an HTTPS service the API server calls for matching requests, which returns allow, deny, or a patch. It is fully general — arbitrary code, external lookups — and that generality is the problem: it is a network hop on every write, a service you must run with high availability, and a failure point where failurePolicy: Fail blocks all matching writes when it is down and Ignore silently disables your policy. Kyverno and OPA Gatekeeper are webhook-based policy engines. ValidatingAdmissionPolicy, stable since 1.30, moves common validation into the API server: the policy is a resource containing CEL expressions — the Common Expression Language, a small, safe expression syntax — evaluated against the object, the old object, the request, and optional parameter resources, with a binding that scopes it to namespaces or labels. "Every container must set memory limits", "images must come from our registry", "no latest tag", "replicas must be at most the namespace's limit from a parameter ConfigMap" are all expressible with no service to run, no network hop, and no failure mode beyond an expression error. MutatingAdmissionPolicy extends the same model to mutation, beta as of 1.32. You still need a webhook when the decision needs data outside the request — a signature check against a registry, a lookup in an external system — when the mutation is complex (sidecar injection), or when the policy engine's ecosystem (reporting, exceptions, audit UI) is the point. Kyverno can compile many of its rules into CEL policies, which is the migration path.

Land it CEL policies put the common rules inside the API server with no service to fail; webhooks remain for decisions that need the outside world — and every webhook is a deploy-blocking dependency you chose.

Likely follow-ups
"Write me a ValidatingAdmissionPolicy that blocks the latest tag and images outside our registry."

The policy and a binding scoped to production namespaces:

apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicy
metadata: {name: image-rules}
spec:
  failurePolicy: Fail
  matchConstraints:
    resourceRules:
    - apiGroups: ["apps", ""]
      apiVersions: ["v1"]
      operations: ["CREATE", "UPDATE"]
      resources: ["deployments", "pods"]
  validations:
  - expression: "object.spec.template.spec.containers.all(c, c.image.startsWith('registry.example.com/'))"
    message: "images must come from registry.example.com"
  - expression: "object.spec.template.spec.containers.all(c, !c.image.endsWith(':latest') && c.image.contains(':'))"
    message: "image tag required and must not be latest"

The binding selects namespaces by label with matchResources.namespaceSelector and sets validationActions: [Deny], or [Audit, Warn] during rollout. In practice I would match Pods only via the variables feature to handle both shapes.

"What happens when a CEL expression errors at runtime, and how do you test policies before enforcing?"

If an expression fails to evaluate, for example accessing a field that does not exist on the object, the policy's failurePolicy decides: Fail rejects the request with the error, Ignore allows it. That is why expressions guard with has() checks, such as has(object.spec.template). Expressions are also cost-limited by the API server, so a policy that iterates deeply over large lists can be rejected at creation. Testing: the binding's validationActions can be Audit and Warn without Deny, so violations appear as audit log annotations and client warnings while nothing is blocked. Locally, kubectl create --dry-run=server against a cluster with the policy in Deny mode, and unit tests through the CEL playground or a small test harness that evaluates expressions against sample manifests in CI.

"How do you migrate from Kyverno webhooks to CEL without losing coverage?"

Inventory first: list every Kyverno ClusterPolicy and classify each rule as pure validation on request data, validation needing an external lookup, mutation, or image verification. The first group is convertible; Kyverno itself can generate ValidatingAdmissionPolicy objects from its validate rules, and as of Aug 2026 it also supports authoring in CEL natively. Deploy the CEL policies in Audit mode alongside the existing Kyverno rules, compare the audit annotations with Kyverno's policy reports for a week, and only then switch the CEL binding to Deny and remove the Kyverno rule. Mutations move to MutatingAdmissionPolicy where the change is a simple patch, and stay in the webhook where they are not. What remains in Kyverno is the image signature verification and anything needing a lookup, and it is now a small, well-understood webhook rather than the gatekeeper for everything.

"Where is MutatingAdmissionPolicy as of today, and would you use it?"

As of Aug 2026 it is beta, on by default since 1.34, with mutations expressed as CEL producing either an apply configuration merged with server-side apply semantics or a JSON patch. It runs inside the API server like its validating sibling, so there is no webhook to fail. I would use it for simple, deterministic defaults: adding the owner label from a namespace annotation, setting seccompProfile when absent, injecting a standard toleration for a team's pool. I would not use it yet for anything that reads external state or that must run in a specific order relative to a webhook, and I would keep sidecar injection in the mesh's webhook. The reasoning is the same as for validation: move the boring rules out of the network path, and keep the webhook for what only a webhook can do.

Q112 · Scenario. "Every deploy in every namespace is failing with 'Internal error occurred: failed calling webhook ... context deadline exceeded'. Running services are fine. Walk through it."

Reveal answer

Strong answer Diagnosis order: a webhook timeout on every write means the API server cannot reach an admission webhook whose failurePolicy is Fail. Evidence: the error names the webhook; kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations shows its configuration and the Service it points to; kubectl get pods -n <its namespace> shows whether that service's Pods are Running and Ready; its Endpoints show whether any exist. Ranked causes. One: the webhook's Pods are down — evicted, crash-looping after their own upgrade, or scaled to zero — and with Fail the API server refuses every write it matches; a webhook that matches all Pods in all namespaces takes down deploys everywhere. Two: a NetworkPolicy or security group blocking the control plane from reaching the webhook Pods (on managed clusters the control plane sits outside the VPC and needs an explicit rule). Three: an expired serving certificate, or the CA bundle in the configuration no longer matching after cert-manager rotated it. Four: the webhook is alive but slow, exceeding timeoutSeconds (10 by default) because of an external call. Immediate mitigation: if the webhook is non-critical, patch its failurePolicy to Ignore or temporarily delete the configuration, restore deploys, then fix the webhook; if it is a security-critical policy, fix the webhook first — but note the trap: if the webhook matches its own namespace, you cannot redeploy it because its own Pods are blocked, which is why the configuration must exclude the webhook's namespace with a namespaceSelector. Prevention: every webhook excludes kube-system and its own namespace, runs with at least two replicas and a PDB, has a short timeout, and an alert on the API server's apiserver_admission_webhook_rejection_count and latency; and prefer CEL policies for anything that does not need a service.

Land it A failing webhook with failurePolicy Fail is a cluster-wide deploy freeze — exclude its own namespace so it can heal, and move every rule that can live in CEL out of the network path.

Likely follow-ups
"You patched failurePolicy to Ignore and deploys work, but now the security policy is off. What next?"

Now I fix the webhook with a clock running, because every deploy in the meantime is unvalidated. I look at why its Pods are down: if it is crash-looping after its own upgrade, roll it back to the previous image; if it was evicted for memory, raise its request; if its certificate expired, let cert-manager reissue and update the CA bundle in the configuration. Once it is Ready and its Endpoints are populated, I test it by creating a Pod that should be rejected, in a scratch namespace, and confirm the rejection, then flip failurePolicy back to Fail. Afterwards I audit what got through during the window: the audit log lists every admitted object in the period, and a script re-evaluates them against the policy so anything non-compliant gets a ticket. And I write down that the window happened.

"How would you tell the difference between the webhook being down, unreachable, and slow?"

Down: its Pods are not Ready and its Endpoints are empty, and the API server error usually says no endpoints available rather than a deadline. Unreachable: the Pods are Ready and Endpoints exist, but the API server times out; from a Pod in another namespace, curl -k https://webhook.policy.svc:443/validate succeeds, which proves the service works inside the cluster, so the block is between the control plane and the Pods, a security group on a managed cluster or a NetworkPolicy on the webhook's namespace that does not allow ingress from outside the cluster. Slow: the API server's apiserver_admission_webhook_admission_duration_seconds histogram for that webhook shows latency near the timeout, and the webhook's own logs show it calling something external. Each has a different fix, and the metric plus one curl distinguishes them in two minutes.

"Why must a webhook exclude its own namespace, and how do you also protect kube-system?"

If the webhook's configuration matches Pods in its own namespace and it is down, then its own Deployment cannot create replacement Pods, because each creation is blocked waiting on the dead webhook; that is a deadlock only a human patching the configuration can break. A namespaceSelector with a matchExpressions entry excluding the namespace's name label removes the loop. kube-system matters for a similar reason: CoreDNS, the CNI, and kube-proxy must be able to restart during a webhook outage, or the failure spreads from "cannot deploy" to "cluster networking cannot heal". Managed providers often enforce that exclusion. The template every webhook in the platform uses carries both exclusions, and an admission policy, in CEL, rejects webhook configurations that lack them.

"What alert would have caught this before every team noticed?"

Two. A synthetic deploy: a CronJob every five minutes that applies and deletes a tiny Deployment in a canary namespace, and an alert if it fails twice in a row, which turns "deploys are broken" into a page ten minutes after it starts instead of when a team files a ticket. And an API server metric alert: apiserver_admission_webhook_rejection_count with error_type="calling_webhook_error" rising, or the webhook admission latency p99 above five seconds. Plus the boring ones: the webhook Deployment's available replicas below its minimum, and its serving certificate expiring within seven days from cert-manager's metrics. The synthetic deploy is the one I would insist on, because it catches every cause with one signal.

Q113 · Design. "Design the software supply chain from a developer's commit to a Pod running in production: what is verified, where, and by what."

Reveal answer

Strong answer Requirements: only images built by our pipeline from reviewed code run in production, known vulnerabilities are caught before deploy, and every running image can be traced to a commit. Design, in stages. Build: CI builds from a protected branch with a reproducible Dockerfile (see E9), a minimal distroless base, a non-root user, and generates a software bill of materials (SBOM) with Syft. Scan: Trivy or Grype scans the image and the SBOM; the pipeline fails on critical vulnerabilities with a fix available, and a documented exception process covers the rest. Sign: the pipeline signs the image digest with Sigstore cosign using keyless signing tied to the CI job's OIDC identity, and attaches the SBOM and a SLSA provenance attestation stating which workflow built which commit. Store: a private registry with immutable tags, retention rules, and a pull-through cache for public base images so builds do not depend on Docker Hub availability or rate limits. Admit: an admission policy (Kyverno's image verification, or the Sigstore policy controller) on production namespaces that verifies the signature against the expected CI identity, requires the provenance attestation, rejects images not from our registry, rejects mutable tags (only digests or tags resolved to digests), and rejects images whose scan attestation is older than a week. Run: Pod Security Admission at restricted, read-only root filesystems, and a runtime sensor (Falco or Tetragon) alerting on unexpected process execution or outbound connections. Trace: the image digest in every log line's metadata and in the deployment record, so an incident maps to a commit in seconds. Trade-offs: keyless signing depends on the public Sigstore infrastructure or a private Rekor instance; scanning produces noise that needs an owner. What I would not do: sign with a long-lived key in a CI secret, scan only at build and never re-scan running images, or allow latest anywhere after dev.

Land it Build minimal, scan, sign with the pipeline's identity, admit only what verifies, and watch at runtime — the admission policy is the point where the whole chain becomes enforceable.

Likely follow-ups
"How does keyless signing work, and what does the admission policy actually verify?"

The CI job, say a GitHub Actions workflow, has an OIDC identity token issued by the CI provider that names the repository, the workflow file, and the branch. Cosign sends that token to the Sigstore certificate authority, Fulcio, which issues a short-lived signing certificate binding a fresh key pair to that identity; cosign signs the image digest with the key, uploads the signature and certificate to the registry alongside the image, and records the signing event in the Rekor transparency log. The key is discarded. At admission, the policy fetches the signature and certificate for the exact digest, checks the certificate chains to Fulcio, checks the Rekor entry proves the signature existed at signing time, and, the crucial part, checks that the certificate's identity matches the expected issuer and subject, for example the production workflow in our organisation's repository. A signature from another workflow is rejected even though it is a valid Sigstore signature.

"What does the admission verification cost per deploy, and what happens when Rekor is unreachable?"

Each Pod admission triggers a registry fetch of the signature manifest and a certificate check, typically 100 to 500 milliseconds, and the policy controller caches results per digest, so a rollout of 20 replicas costs one verification. Rekor is public infrastructure, and if it or the registry is unreachable the webhook's failurePolicy decides whether deploys stop; for production I keep Fail, because an unverified image in production is the risk the whole chain exists to prevent, and I accept that a Sigstore outage delays deploys. To reduce that exposure, verification can use the Rekor inclusion proof bundled with the signature at signing time, which cosign supports, so admission does not need a live Rekor call, and the registry is our own with a pull-through cache. A private Sigstore deployment is the full answer for an organisation that cannot tolerate the dependency.

"A critical CVE lands in a base image used by 150 running services. Walk through the response."

First, scope: the SBOMs attached to every image let a query answer which images contain the vulnerable package and version, in minutes, without rescanning; the running-image inventory from kube-state-metrics tells me which of those are deployed and where. Second, fix: the base image is rebuilt with the patch, and because every service's Dockerfile pins the base by tag that the platform controls, a rebuild pipeline triggers across the 150 services, producing new signed images. Third, deploy: the GitOps tag updates flow as usual, ordered by exposure, internet-facing first, through canaries. Fourth, verify: the admission policy can be updated to reject images whose SBOM attestation contains the vulnerable version, which blocks any straggler at its next rollout. The whole cycle is a day if the pipeline is automated and a month if it is not, which is the argument for the automation.

"What would you cut under time pressure, and what is non-negotiable before production?"

I would cut the provenance attestation and the SBOM in a first version and add them a sprint later. I would cut runtime sensing to a later phase. I would cut the scan-age rule. Non-negotiable: a private registry with immutable tags and the admission rule that only that registry is allowed, because that alone stops most accidental exposure; signing with the pipeline's identity and verifying it at admission for production namespaces, because that is the control that makes "only our pipeline's images run" true; and vulnerability scanning that fails the build on critical fixable findings, because it is a checkbox in every audit and a real reduction in exposure. Those three are a week with the tooling available today, and the rest builds on them.

Q114. "Explain what runAsNonRoot, readOnlyRootFilesystem, dropping capabilities, and a seccomp profile each prevent, with a concrete attack for each."

Reveal answer

Strong answer These are the four lines of the restricted profile, and each closes a specific door. runAsNonRoot with an explicit runAsUser makes the process an unprivileged user inside the container; an attacker who exploits the application cannot write to system paths, install packages, or bind low ports, and most container-escape techniques begin with root in the container — because on a shared kernel, root in the container is root on the node for any resource the container can reach. readOnlyRootFilesystem mounts the image's filesystem read-only, with writable emptyDirs only where the application needs them (/tmp); an attacker who gets code execution cannot drop a binary, modify the application, or persist a cron entry — a downloaded crypto miner has nowhere to land. Dropping all capabilities removes the slices of root privilege Linux grants to processes: without NET_RAW the attacker cannot forge packets or sniff the Pod network; without SYS_ADMIN they cannot mount filesystems, which is the capability behind several historic escapes; NET_BIND_SERVICE is the only one a web server might add back, and with a port above 1024 it needs none. A seccomp profile filters system calls: RuntimeDefault blocks the roughly 40 dangerous calls containerd's default profile lists — mount, ptrace on other processes, kernel module loading, unshare for new namespaces — which were the entry point of the runc and kernel escapes of past years. Together with allowPrivilegeEscalation: false, which stops setuid binaries from regaining root, a compromised Spring Boot process is confined to being a Spring Boot process, and the blast radius is the application's own data and network reach — which is what the NetworkPolicy then bounds.

Land it Non-root, read-only, no capabilities, filtered syscalls — each one removes a step from a known escape chain, and together they turn a code-execution bug into a contained incident rather than a node compromise.

Likely follow-ups
"Write the securityContext for a Spring Boot container that satisfies restricted, and explain each line."

At Pod level and container level:

securityContext:
  runAsNonRoot: true
  runAsUser: 10001
  runAsGroup: 10001
  fsGroup: 10001
  seccompProfile: {type: RuntimeDefault}
containers:
- name: app
  securityContext:
    allowPrivilegeEscalation: false
    readOnlyRootFilesystem: true
    capabilities: {drop: ["ALL"]}
  volumeMounts:
  - {name: tmp, mountPath: /tmp}
volumes:
- {name: tmp, emptyDir: {sizeLimit: 512Mi}}

runAsUser with a numeric ID satisfies runAsNonRoot even if the image does not declare a user; fsGroup makes mounted volumes writable by that group; the emptyDir gives the JVM a writable temp directory, and -Djava.io.tmpdir=/tmp plus Tomcat's work directory pointing there completes it. The port must be above 1024, and the JVM must not try to write heap dumps or logs anywhere else.

"What does RuntimeDefault actually block, and when would you need a custom seccomp profile?"

containerd's default profile allows around 300 of the roughly 400 Linux system calls and blocks the ones with no business in an application container: mount, umount2, reboot, swapon, init_module and finit_module for kernel modules, kexec_load, ptrace in older kernels, unshare and clone with namespace flags, bpf, perf_event_open, and the like. A JVM runs fine on it. You need a custom profile, type: Localhost with a file on the node, either to tighten further, allowing only the calls a specific service makes, which the Security Profiles Operator can record for you, or to allow one blocked call a legitimate tool needs, for example a profiler that uses perf_event_open. The blocked list changes between runtime versions, so a custom profile is a maintenance commitment.

"How would you verify these controls are actually in effect on a running Pod?"

From an ephemeral debug container sharing the process namespace, or from the process itself: cat /proc/1/status shows Uid lines for the user, CapEff for effective capabilities, which should be all zeros, NoNewPrivs: 1 for the privilege-escalation setting, and Seccomp: 2 for filter mode. touch /usr/bin/x fails with a read-only filesystem error. kubectl get pod -o jsonpath confirms the spec, but the spec can differ from reality if a webhook mutated it or the runtime ignored something, which is why I check the process. As a continuous control, a runtime sensor such as Tetragon or Falco can alert on any process running as UID 0 or any write to a path outside the allowed volumes, which catches regressions the manifest review missed.

"Which of the four would you drop first if a legacy application resists, and why?"

I would relax readOnlyRootFilesystem first, because it is the one most likely to break a legacy application that writes to paths scattered across the image, and its protection, preventing persistence and dropped binaries, is partially covered by the runtime sensor and by the fact that a Pod restart wipes the writable layer anyway. I would relax it by adding emptyDirs for the specific paths before dropping it entirely. I would not relax non-root, because root in the container is the starting point of nearly every escape. I would not add capabilities back beyond NET_BIND_SERVICE. And I would not disable seccomp, because a legacy application almost never needs the blocked calls; when someone says it does, it is worth finding out which one and why.

Q115 · Scenario. "A runtime sensor alerts on a crypto-mining process inside a Pod of an internal reporting service. Walk me through the first hour: containment, investigation, and what you check about the rest of the cluster."

Reveal answer

Strong answer I would proceed in this order:

  1. Contain without destroying evidence. Apply a NetworkPolicy to the Pod's labels that denies all egress and ingress, cutting the miner off from its pool and any command channel; cordon the node; remove the Pod from its Service by changing a label rather than deleting it — a deleted Pod takes its filesystem and process list with it. Capture kubectl get pod -o yaml, an ephemeral-container snapshot of the process tree, open connections, and any dropped files, and a node-level disk snapshot.
  2. Determine the entry. Ranked possibilities: an exploited application vulnerability (the reporting service parses uploads, a classic path), a compromised image or dependency that shipped the miner, or a stolen credential used to exec into the Pod or create one — the API server audit log answers the last one quickly (any exec, create, or unusual identity against that namespace). Check the image digest against what the pipeline signed; check whether the container was running as root and whether the filesystem was writable, because that determines what else the attacker could have done.
  3. Determine the reach. What could this Pod access: its ServiceAccount's RBAC (auth can-i --list as it), its projected cloud identity and what that role permits, its NetworkPolicy egress, and any Secrets mounted. Rotate every credential the Pod could see. Search the cluster for the same binary or process name across nodes with the sensor, and for other Pods from the same image or with the same vulnerability.
  4. Eradicate and recover. Patch the vulnerability, rebuild and redeploy the image, replace the node rather than clean it, and lift the containment only on the new Pods.
  5. Prevent. Whatever was missing from the baseline that allowed it — writable filesystem, root, egress to the internet from a reporting service, a wildcard cloud role — becomes an admission rule, and the incident review states which one.

Land it Isolate with a policy rather than a delete, learn the entry from the audit log and the reach from the identity, rotate everything it could see, and replace rather than clean.

Likely follow-ups
"You applied the isolation NetworkPolicy but the miner is still talking to its pool. Why, and what next?"

Three possibilities. The policy is not being enforced on this path: the Pod is on host networking, or the CNI does not enforce egress, or the connection was established before the policy and the CNI's conntrack keeps existing flows alive, which some plugins do. Or the traffic is leaving through a path the policy does not govern, for example a mesh sidecar's egress gateway or DNS tunnelling on port 53 that the DNS allow rule permits. Or the process moved: it spawned a child on another Pod or on the node through a shared volume. Next steps: confirm with the flow log whether packets are actually leaving, and if so, cut harder by cordoning the node and removing its route to the internet at the cloud level, security group or NAT gateway rule, while I keep the Pod for forensics. Containment beats cleanliness when the policy layer has failed.

"How do you capture evidence from a distroless container without a shell, before you touch anything?"

An ephemeral container with kubectl debug --target=app --image=forensic-tools shares the process namespace, so I can read /proc/<pid>/ for the miner: exe for the binary path, cmdline, environ, maps, and fd for open files and sockets; copy the binary out with cat /proc/<pid>/exe > /evidence/miner; and dump the container filesystem through /proc/<pid>/root to a tarball. ss -tnp in that namespace lists connections with process IDs. On the node, crictl inspect gives the container's overlay upper directory, which contains every file the attacker wrote, and a disk snapshot of the node through the cloud API preserves it. All of this happens before any restart, and the timestamps and hashes go into the incident record.

"What in the audit log would tell you the entry was a stolen credential rather than an exploit?"

The audit log at request level for the namespace, filtered to the hours before the alert. A stolen credential shows as an unusual identity or source: a create on pods/exec or pods/ephemeralcontainers against the reporting Pod, a create of a Pod or Deployment with a strange image, a get on the namespace's Secrets, or a token issued to the Pod's ServiceAccount being used from an IP outside the cluster. An exploit through the application leaves no audit entries at all, because the application does not use the API; its trail is in the application's access logs, a suspicious upload or request path around the time the process started. So the absence of API activity plus a suspicious request in the application log points at the application, and the presence of an exec points at a credential.

"What would you change in the platform baseline the day after, in order of impact?"

First, default-deny egress with no internet route for internal services; a reporting service has no reason to reach a mining pool, and the policy alone would have made the miner useless. Second, readOnlyRootFilesystem plus dropped capabilities enforced at admission, so a downloaded binary has nowhere to land or run. Third, per-namespace runtime detection rules that alert on any new executable being run that was not in the image, which the sensor can compute from the image's file list. Fourth, exec into production only through break-glass with an approval and a page to the security channel. Fifth, the scan-age rule so an image with a known exploitable vulnerability cannot be deployed, since the entry was probably a known bug in an upload parser. Each is a line in the incident review with an owner and a date.

10 · DrillProduction Scenarios & Design — Q116–Q150

The last section is the senior round proper: incidents that cross layers, and designs that have to name their trade-offs. The interviewer is no longer checking that you know the objects; they are checking whether you would be safe to hand a pager and a budget. Answer the scenarios in diagnosis order and the designs with requirements first, and say what you would refuse to do — that refusal is usually where the senior signal lives.

Drill · Observability & debugging

These questions test whether you can find the unhappy layer quickly, and whether your monitoring would have told you before the page did.

Q116. "Where do cluster metrics come from — metrics-server, kube-state-metrics, cAdvisor, the application — and which five metrics would you put on every service's dashboard?"

Reveal answer

Strong answer Four sources with different jobs. cAdvisor, built into the kubelet, measures containers from the cgroups: CPU time, throttled periods, working-set memory, network and disk I/O; Prometheus scrapes it from each kubelet. metrics-server aggregates a subset of that — current CPU and memory per Pod and node — into the metrics.k8s.io API for kubectl top and the HPA; it keeps no history and is not monitoring. kube-state-metrics turns object state from the API server into metrics: desired versus available replicas, restart counts, Pending Pods, PDB allowed disruptions, HPA current and desired replicas, node conditions. The application exposes its own through Micrometer at /actuator/prometheus: request rate, latency histograms, error counts, pool usage, JVM memory and GC. The five for every service's dashboard: request rate and error rate by status class from the application (or from the gateway, which is more honest); p99 latency as a histogram quantile; CPU throttling ratio from cAdvisor, because it explains latency the application cannot see; working-set memory as a percentage of the limit, because that is what the OOM killer compares; and restarts plus available-versus-desired replicas from kube-state-metrics, because a service can be "up" with two of five Pods and nobody notices. Everything else — GC time, pool waits, HPA status — sits on the second row.

Land it The application tells you what users feel, cAdvisor tells you what the kernel is doing to you, and kube-state-metrics tells you what the cluster thinks you have — a dashboard needs all three rows.

Likely follow-ups
"Write the PromQL for the throttling ratio and the working-set percentage, and say what thresholds you would alert on."

Throttling ratio per container: rate(container_cpu_cfs_throttled_periods_total[5m]) / rate(container_cpu_cfs_periods_total[5m]), which gives the fraction of 100-millisecond scheduling periods in which the container hit its quota; above 0.25 sustained for ten minutes is a ticket, because it means a quarter of the time the process wanted CPU and was stopped, and that shows in tail latency. Working set: container_memory_working_set_bytes / kube_pod_container_resource_limits{resource="memory"} joined on pod and container labels, alerting at 0.85 for fifteen minutes, because the OOM killer fires at 1.0 and a JVM near 0.85 has no room for a burst of direct buffers or metaspace. Both queries need the container!="" filter to exclude the Pod-level cgroup line that cAdvisor also exports, a classic double-counting trap.

"Why is the gateway's error rate more honest than the application's own?"

The application can only count requests that reached it. A Pod that is crash-looping, a Pod removed from the EndpointSlice, a connection refused during startup, a timeout in the proxy before the backend answered, or a request dropped by a NetworkPolicy: none of those appear in the application's Micrometer counters, and yet the user saw an error. The gateway proxy sees every request that arrived at the front door and every response or lack of one, so its per-route 5xx rate and timeout count is the user's experience. The application's metrics remain essential for the breakdown, which endpoint, which dependency, which status, but the service-level objective should be measured at the edge. Where there is no gateway, the caller's client-side metrics play the same role.

"metrics-server shows the HPA a number that disagrees with Prometheus. Why, and which do you trust?"

They measure differently. metrics-server scrapes the kubelet's summary API every 15 seconds and reports an instantaneous CPU rate computed over a short window, and the HPA averages that over its own sync period; Prometheus computes rate() over whatever window you ask, typically five minutes, from cAdvisor's cumulative counters. A bursty workload therefore looks higher on the HPA's number and smoother on Prometheus. For memory, metrics-server reports working set, the same as cAdvisor, so they should agree within a scrape interval. I trust each for its job: the HPA's number is what the HPA acted on, so I use it to explain scaling decisions, and Prometheus for history and alerting. If they differ wildly, one of them is scraping a stale kubelet, and kubectl top pods versus a Prometheus query at the same instant shows which.

"What would you add for a JVM service specifically, and what would you leave off the first row?"

On the second row for a JVM: garbage-collection pause time from jvm_gc_pause_seconds, both count and max, because a two-second pause explains a p99 spike that CPU cannot; heap used versus max, to see whether the container limit or the heap is the constraint; and HikariCP's pending connections, the count of threads waiting on the pool, because a slow database appears there long before it appears as latency. Thread count for detecting a runaway executor. What I would leave off the first row is anything that does not change what you do next: JVM version, uptime, class count, and per-endpoint breakdowns that belong in a drill-down. The first row is five signals a person can read in five seconds during an incident, and everything else is one click away.

Q117 · Scenario. "The platform team migrated a node pool from 16-CPU to 4-CPU instances to 'reduce waste'. Bin-packing looks better, but p99 latency for every JVM service on the pool tripled. Explain."

Reveal answer

Strong answer Diagnosis order: the symptom is uniform across services and coincides with the instance change, so the cause is structural, not application-level. Evidence: throttling ratios if any CPU limits exist; per-node allocatable versus requested; and the per-node DaemonSet footprint. Ranked causes. One: burst headroom vanished. On a 16-CPU node, a JVM with a 1-CPU request could borrow ten idle cores for a garbage-collection cycle or a traffic spike; on a 4-CPU node packed with three such JVMs plus DaemonSets, there is nothing to borrow, so every burst queues on the kernel scheduler and the tail latency shows it. Requests unchanged, usage unchanged, latency tripled. Two: per-node overhead — the CNI, log shipper, metrics agent, and mesh proxy take roughly the same absolute CPU on every node, so on a 4-CPU node they consume a quarter of it and the workloads get less than the arithmetic suggested. Three: JVM ergonomics — ActiveProcessorCount or the container's visible CPU count dropped from 16 to 4, shrinking GC parallelism and common pools. Four: more nodes means more cross-node network hops between services that used to be co-located. Fix: return to larger instances for latency-sensitive pools (fewer, larger nodes is the right shape for JVMs), keep bin-packing goals for batch pools, and if the budget requires smaller nodes, reduce per-node agents and set explicit spread constraints so a node holds at most one replica of any bursty service. Prevention: latency, not just utilisation, in the acceptance criteria for any node-pool change, tested on a canary pool first.

Land it Utilisation went up because the slack went away, and the slack was what absorbed every JVM's bursts — for latency-sensitive services, waste and headroom are the same number.

Likely follow-ups
"How would you prove the burst-headroom explanation with data rather than a story?"

Three measurements before and after. Per-node CPU utilisation at one-second resolution from node-exporter, not five-minute averages: on the small nodes it will show saturation spikes, 100 percent for a few hundred milliseconds at a time, that the averages hide. The kernel's run-queue length, node_load1 against core count, or better the pressure stall information metric node_pressure_cpu_waiting_seconds_total, which directly measures time tasks spent waiting for CPU; a rising rate on the 4-CPU nodes is the proof. And per-Pod container_cpu_cfs_throttled_periods_total if limits exist. Then a controlled test: move one service back to a 16-CPU node with unchanged requests and watch its p99 drop. That single comparison, same image and configuration, different node, is the evidence that convinces a finance-minded audience.

"The platform team says they cannot afford the big instances. What is the compromise?"

Keep the small instances for the workloads that do not care, batch and asynchronous workers, and give latency-sensitive services their own pool of medium instances, 8 CPUs, with a spread rule of one replica per node for the burstiest services through topologySpreadConstraints on hostname with maxSkew: 1. Trim the per-node agents: one collector DaemonSet instead of three, and check whether the mesh sidecar is needed on every Pod. Raise CPU requests on the JVM services to something closer to their burst, say one core, so the scheduler packs fewer of them per node; that costs capacity but it is honest capacity. And set -XX:ActiveProcessorCount explicitly so GC threads are not sized by the tiny node. The cost of that compromise is measurable, and I would present it beside the latency numbers so the trade is explicit.

"What does the JVM do differently when it sees 4 CPUs instead of 16?"

The JVM reads the container's CPU quota, or the node's core count if there is no limit, and sizes several things from it. The garbage collector's parallel thread count follows the CPU count, so G1 on 4 CPUs uses 4 parallel GC threads instead of 13, and a young-collection that took 20 milliseconds now takes 60. The common ForkJoinPool, which parallel streams and CompletableFuture default to, has parallelism of CPUs minus one, so 3 instead of 15. Some libraries size thread pools and buffers from availableProcessors(). Netty's event loop count halves several times over. None of that is wrong, it is correct for a 4-CPU machine, but a service tuned on 16 visible CPUs was leaning on that parallelism, and the tripled p99 is partly GC pauses that got longer for that reason.

"What acceptance criteria would you put on the next node-pool change?"

A canary pool with 10 percent of the services for a week, and four gates: p99 latency per service within 10 percent of the old pool; CPU pressure stall time per node below a threshold; no increase in throttled periods; and cost per request, not cost per node, improved, computed from OpenCost's allocation divided by the gateway's request count. The last one is the number that reframes the discussion: a node pool that is 40 percent cheaper but needs 30 percent more replicas to hold latency saved little, and one that tripled p99 costs revenue that never appears on the cloud bill. The change is signed off by the owning teams on those numbers, and rolled to the rest of the fleet pool by pool, not all at once.

Q118. "The image is distroless — no shell, no tools. A Pod is misbehaving. How do you get inside it, and inside its node, without changing the image?"

Reveal answer

Strong answer Ephemeral containers, stable since 1.25, add a temporary container to a running Pod: kubectl debug -it orders-abc --image=nicolaka/netshoot --target=orders starts a container with tools inside the Pod's namespaces, and --target shares the process namespace of the named container so I can see its process, read /proc/<pid>/, and — because the process namespace is shared — reach its filesystem at /proc/<pid>/root. From there: ss for connections, jcmd or jstack if the debug image carries a JDK matching the target's, tcpdump on the Pod's interface, curl to the actuator on localhost. Ephemeral containers cannot be removed from a running Pod and have no resource limits by default, so they are for diagnosis, not permanence. For a copy that you can modify, kubectl debug orders-abc --copy-to=orders-debug --container=orders -- sh clones the Pod with a different command. For the node: kubectl debug node/ip-10-0-1-40 -it --image=ubuntu creates a privileged Pod on the node with the host filesystem at /host, host networking, and host PID, so chroot /host gives me the node itself — kubelet logs with journalctl -u kubelet, crictl ps for containers, disk and conntrack. Both need RBAC: the pods/ephemeralcontainers subresource for the first, and node debug is effectively root on the node, so it is a break-glass permission. And on a cluster with Pod Security Admission at restricted, the debug Pod must land in a privileged namespace such as kube-system or a dedicated one.

Land it Distroless removes the shell from the attacker and from you — ephemeral containers give it back to you alone, and node debug is root, so gate both with RBAC.

Likely follow-ups
"How do you take a heap dump or thread dump from a distroless JVM this way?"

The debug image must carry a JDK of the same major version as the target, because jcmd attaches through a Unix socket that the target JVM creates in its temp directory and the attach protocol is version-sensitive. With --target=app the process namespace is shared, and the JVM's temp directory is visible at /proc/<pid>/root/tmp, but the attach mechanism looks for it at /tmp relative to the target's namespace; running jcmd <pid> Thread.print usually works when the debug container runs as the same UID as the target, which the kubectl debug --profile=sysadmin or a matching runAsUser ensures. For a heap dump, jcmd <pid> GC.heap_dump /tmp/heap.hprof writes into the target's filesystem, so it must have a writable path, which is why the emptyDir at /tmp exists, and the file is copied out with kubectl cp from the debug container through /proc/<pid>/root/tmp.

"An ephemeral container fails to start with a security policy error. What is happening?"

The ephemeral container is subject to the same Pod Security Admission checks as the Pod, so in a namespace enforcing restricted, a debug image that runs as root, or that the profile you chose sets as privileged, is rejected at admission with the exact violation named. Options: use kubectl debug --profile=restricted, which as of Aug 2026 sets non-root, dropped capabilities, and seccomp on the debug container so it passes; use a debug image built to run as a non-root user with the tools installed; or, if the diagnosis genuinely needs privileges, use the copy-to-namespace approach, --copy-to into a privileged debugging namespace, accepting that the copy is not the live Pod. The mistake is to loosen the namespace's label for the duration, which is a change to production security to fix a debugging inconvenience.

"How do you stop node debug from becoming a way for anyone to get root on production?"

Node debug is a Pod with hostPID, host networking, a hostPath at /, and usually privileged, so whoever can create it is root on the node. Containment: the RBAC to create Pods in a privileged namespace is held by a break-glass group only; the debug namespace is labelled privileged and nothing else is; the just-in-time elevation logs and expires; the audit log at request level captures the Pod spec created; and a runtime sensor alerts on any privileged Pod creation, so the security channel sees it in real time. Application namespaces at restricted cannot host such a Pod at all, which means a developer's normal identity physically cannot do it even by mistake. The compromise for day-to-day is a read-only node inspection tool, a DaemonSet exposing logs and metrics, so the privileged path is rare.

"When would you not use ephemeral containers and instead reproduce elsewhere?"

When the Pod is under memory pressure, because the debug container shares the Pod's cgroup and has no limits of its own, so a heap dump of a 4 GiB heap can push the whole Pod over its memory limit and get it OOM-killed mid-investigation. When the investigation needs a different command or environment variables, which ephemeral containers cannot change on the target. When the Pod is part of a StatefulSet with a quorum, where attaching profilers risks pauses that trigger a leader election. And when I need to run the investigation repeatedly, where a --copy-to clone with a bigger memory limit and the same image, in a scratch namespace pointed at the same dependencies, is safer and reproducible. The live Pod is for evidence; the clone is for experiments.

Q119 · Scenario. "A service's latency is fine on nine nodes and terrible on one. Same image, same config. What do you check on that node, in order?"

Reveal answer

Strong answer Diagnosis order: a single bad node points at that node's environment, not the application. Evidence first: kubectl get pods -o wide --field-selector spec.nodeName=<node> to see what else lives there, and kubectl describe node for conditions, allocated resources, and taints. Ranked checks. One: a noisy neighbour — a batch Pod or a Pod without a CPU request burning cores, or a memory-heavy Pod pushing the node into reclaim; the node's total CPU and memory pressure, and per-Pod usage, show it. Two: the node's own DaemonSets unhealthy or restarting — a crash-looping CNI agent or log shipper can consume CPU and drop packets; NodeLocal DNSCache not running on that node makes every lookup slower there. Three: hardware or instance — a different, older instance type in the same pool (mixed-instance policies), a node with a degraded disk (high I/O wait in vmstat from a node debug), or a steal-time spike on a shared host. Four: network — the node in a different zone from its dependencies so every call crosses zones; an MTU mismatch on that node; conntrack table nearly full (conntrack -S, nf_conntrack_count). Five: kernel and kubelet version drift after a partial upgrade. Fix: cordon and drain the node to move traffic off immediately — that is the mitigation regardless of cause — then investigate at leisure, and replace the node rather than repair it if the cause is hardware. Prevention: per-node latency and throttling panels so a single bad node stands out, homogeneous instance types per pool, and a node-problem-detector that cordons on kernel or disk errors.

Land it Drain the bad node first, ask questions second — and the questions are neighbours, agents, hardware, network, then drift.

Likely follow-ups
"You drained the node and the problem moved to another node. What does that tell you?"

That the cause was a Pod, not the node. Something that lived on the drained node moved with the drain and is now degrading its new host: a noisy neighbour with no CPU request, a Pod with a memory leak driving the node into reclaim, or the affected service's own replica that has a bad state, a stuck thread or a huge in-memory cache. kubectl get pods -A -o wide before and after the drain, intersected, gives the short list of candidates that moved to the new bad node. Then per-Pod CPU and memory from cAdvisor on that node names it. The fix is to give that Pod a proper request so the scheduler accounts for it, or fix the leak. And I would stop draining, because each drain moves the problem to a fresh node and adds churn.

"How do you detect steal time and I/O wait on a node, and what do they mean?"

node-exporter's node_cpu_seconds_total has a mode label; the rate with mode="steal" is the fraction of time the hypervisor ran another tenant's virtual machine on the physical core this node was scheduled on, and above a few percent means a noisy physical neighbour or a burstable instance type that has exhausted its credits, which shows in the cloud's CPU credit metrics. mode="iowait" is time the CPU was idle only because a process was blocked on disk, and a high rate points at a degraded disk or a workload hammering the root volume; node_disk_io_time_seconds_total and the disk's await from iostat from a node debug confirm. Both are node-level and invisible to any application metric, which is why the per-node panel exists. The fix for both is replacement, not tuning.

"How would you make sure a bad node is caught before a customer notices?"

Three layers. A per-node latency panel, the service's p99 grouped by the node label from kube-state-metrics' Pod-to-node mapping, with an alert when one node's value is more than twice the median for ten minutes. node-problem-detector running as a DaemonSet, which watches kernel logs, disk errors, and NTP drift, sets node conditions, and, with the Draino or descheduler integration, cordons the node automatically. And a cloud-level health check: instance status checks and, for burstable types, a credit-balance alert. When any of those fires, the automated action is cordon and page, so a human decides on the drain with the node already out of the scheduling pool. The cost is small: one DaemonSet and three alert rules.

"What would you check if the slow node is in a different zone from the others?"

Zone placement of the dependencies. If the database, the cache, or the Kafka brokers sit in zones A and B and this node is in zone C, every call crosses a zone boundary, one to two milliseconds each way, and a request touching the database ten times gains 20 milliseconds. I would check topology-aware routing on the Services involved, the service.kubernetes.io/topology-mode: Auto annotation, which prefers same-zone endpoints when the distribution allows it, and whether the caller's own dependencies have any endpoint in zone C at all. Cross-zone data transfer also costs money. The fix is either spreading the dependencies across all three zones, or accepting the latency and documenting it. The interview point is that a node can be perfectly healthy and still be slow because of where it is.

Q120 · Design. "Design the observability stack for a 40-node cluster with 200 services: metrics, logs, traces, alerting, and retention — with numbers."

Reveal answer

Strong answer Requirements: every service gets metrics, logs, and traces without per-team setup; the stack survives the cluster's own incidents; costs are bounded. Design. Metrics: the kube-prometheus-stack chart — Prometheus Operator, Prometheus with two replicas scraping kubelets, cAdvisor, kube-state-metrics, node-exporter, and every Pod with a ServiceMonitor generated by the platform chart; 200 services at about 2,000 series each plus infrastructure is roughly a million active series, which one Prometheus handles, with 15 days of local retention and remote write to a long-term store (Thanos, Mimir, or a managed Prometheus) for 13 months at lower resolution. Logs: stdout only, a DaemonSet (the OpenTelemetry Collector or Vector) tailing /var/log/pods, enriching with Pod labels, and shipping to Loki or a managed log store; at 200 services producing perhaps 50 GB a day, 30 days hot and a year in object storage; structured JSON logging in the service template so fields are queryable. Traces: OpenTelemetry Java agent injected by the platform chart (auto-instrumentation via the OpenTelemetry Operator), exporting to a Collector Deployment that tail-samples — keep every error and slow trace, 5 percent of the rest — into Tempo or Jaeger; 7 days retention. Trace and log correlation through the trace ID in every log line. Alerting: Alertmanager with routes per team from a namespace label; a platform alert set (Pending Pods, restarts, throttling, node pressure, PDB blocked, HPA at maximum, webhook latency, etcd and API latency) plus per-service SLO alerts on error rate and latency burn rates that teams own. Placement: the whole stack on a system node pool with its own PDBs, so a workload incident cannot take the monitoring down with it, and a synthetic monitor from outside the cluster that pages if Prometheus itself is unreachable. Trade-offs: Prometheus at a million series needs care with label cardinality — a per-request-ID label from one service can double it — so an admission-time or scrape-time limit on series per Pod is part of the design. What I would not do: per-team monitoring stacks, logging to files inside containers, or 100 percent trace sampling.

Land it One Prometheus with remote write, one log pipeline from stdout, auto-instrumented traces with tail sampling, all on a protected pool with an outside watcher — and cardinality limits so the stack cannot be sunk by one enthusiastic label.

Likely follow-ups
"Requirement change: 400 nodes and 2,000 services. What in this design breaks first?"

Prometheus. Ten million active series is beyond one instance's comfortable range, so the single scraper becomes sharded scrapers, either the Prometheus Operator's sharding across several instances by target hash, or the OpenTelemetry Collector's target allocator, with all of them remote-writing to Mimir or Thanos, which holds the global view; queries go to the store, not to any one Prometheus. Second to break is the log volume: 500 GB a day needs a log pipeline with buffering, Kafka or the collector's persistent queue, and Loki in its distributed mode with object storage. Third, Alertmanager's routing configuration becomes unmanageable by hand and is generated from namespace labels. What does not change is the shape: scrape, remote write, stdout logs, tail-sampled traces, protected pool. The pieces get horizontally scaled rather than replaced.

"How does tail sampling work, and what does it cost the Collector?"

Head sampling decides at the start of a trace whether to keep it, so it cannot know whether the trace will be slow or fail. Tail sampling waits until a trace's spans have all arrived, holds them in memory for a decision window, ten to thirty seconds, then applies policies: keep if any span has an error status, keep if the total duration exceeds a threshold, keep a percentage of the rest. The cost is memory in the Collector for every in-flight trace during the window, roughly the span volume times the window, and the requirement that all spans of one trace reach the same Collector instance, which needs a load-balancing exporter that routes by trace ID in front of the tail-sampling tier. For 200 services that is a Collector Deployment of a few replicas with several gigabytes each. The gain is that every slow or failed request is fully traced while storage stays at a twentieth of the raw volume.

"How do you keep one service's label explosion from taking down Prometheus?"

Limits at three points. On the scrape configuration, sampleLimit per target, say 5,000 series, so a Pod exposing more is dropped from that scrape and a metric prometheus_target_scrapes_exceeded_sample_limit_total records it; the ServiceMonitor generated by the platform chart sets it. On the application side, Micrometer's MeterFilter.maximumAllowableTags caps the distinct values of a tag, so a request ID or user ID used as a tag stops at a few hundred values. And a standing query for cardinality growth: topk(10, count by (__name__)({__name__=~".+"})) compared day to day, with an alert on any metric name that grew tenfold. The senior detail is that a label explosion also breaks the remote-write path and the long-term store's bill, so the limit at scrape time is the one that protects everything downstream.

"What would you cut under time pressure to have something useful in two weeks?"

Week one: kube-prometheus-stack with the default dashboards and the platform alert set, and the log DaemonSet shipping to a managed log store, because metrics and logs cover most incidents. Week two: OpenTelemetry auto-instrumentation for traces into a managed tracing backend, with simple head sampling at 10 percent, deferring tail sampling. I would defer long-term metric storage and accept 15 days local, defer per-team alert routing and route everything to one channel with the namespace in the message, and defer log retention tiers. I would not cut the system node pool for the stack, because monitoring that dies with the workload is the first thing a real incident exposes, and I would not cut structured logging in the service template, because unstructured logs are painful to retrofit.

Q121 · Scenario. "Since the Postgres Pod moved to another node during maintenance, a Spring Boot service throws 'HikariPool connection is not available, request timed out after 30000ms' every few minutes, though the database is healthy. Connect the Kubernetes event to the application symptom."

Reveal answer

Strong answer Diagnosis order: the pool exhaustion started at the move, so the move broke something the pool depended on. Evidence: HikariCP's metrics — active, idle, pending — show connections going active and never returning; the application logs before the timeouts show statements hanging rather than failing. Ranked causes. One: half-open connections. The old database Pod died without closing its sockets; the application's pooled connections point at an IP that no longer answers, and without TCP keepalive or a Hikari maxLifetime shorter than the kernel's timeout, each borrowed connection hangs until the kernel gives up (which can be 15 minutes with default retransmission settings), while the pool's other connections drain the same way. That is the exact shape here. Two: the new Pod has a new IP, and the application resolved the Service name once at startup — fine if it connects via the Service (kube-proxy routes to the new endpoint), broken if it cached a Pod IP from a headless Service or the JVM's DNS cache held the old answer (networkaddress.cache.ttl). Three: a NetworkPolicy or zone difference on the new node. Fix: set HikariCP's maxLifetime to well below any infrastructure timeout (say 10 minutes) and keepaliveTime to a minute so dead connections are detected; enable TCP keepalive on the driver (tcpKeepAlive=true for the PostgreSQL driver) and a socketTimeout; connect through a Service or PgBouncer, never a Pod IP; and restart the affected Pods now to clear the dead connections. Prevention: a game day that kills the database Pod and watches recovery time, and these pool settings in the service template — the same settings the Java drill and E8 recommend for failover generally.

Land it A Pod move is a database failover as far as the pool is concerned — connections must have a lifetime and a keepalive, or the pool drowns in sockets waiting for a host that no longer exists.

Likely follow-ups
"Explain why a dead-peer connection hangs for so long. Where do the 15 minutes come from?"

When the database Pod's node vanished, no FIN or RST was ever sent, so the client's kernel believes the connection is fine. A query is written to the socket; the data goes unacknowledged; the kernel retransmits with exponential backoff, and Linux's default tcp_retries2 of 15 retransmissions works out to roughly 13 to 15 minutes before the kernel gives up and reports an error to the application. During that time the JDBC call blocks unless the driver has a socketTimeout. An idle connection is worse: with no data to send, nothing detects the peer is gone until TCP keepalive fires, and the default keepalive starts after two hours. So a pool of ten connections, each borrowed and each hanging for 15 minutes, is exactly the 30-second acquisition timeout the log shows, repeated every few minutes as connections rotate through the dead state.

"Which settings, with values, would you put in the service template, and what do they each protect against?"

HikariCP: maxLifetime=600000, ten minutes, so no connection outlives an infrastructure change by long; keepaliveTime=60000, so idle connections are tested every minute and dead ones dropped before a borrower gets them; connectionTimeout=5000, so a borrower fails fast when the pool is empty rather than waiting 30 seconds; validationTimeout=2000. PostgreSQL JDBC URL: tcpKeepAlive=true, socketTimeout=30 seconds as a hard ceiling on any single statement's wait, and connectTimeout=5. A query timeout per statement through spring.jpa.properties.jakarta.persistence.query.timeout or a transaction timeout, so a slow query cannot hold a connection forever. Kernel-level, in the Pod's securityContext.sysctls or the node: net.ipv4.tcp_retries2=8 to shorten the retransmission ceiling to about a minute. Each one bounds a different wait.

"You applied the pool settings and it still happens. What next?"

Then either the settings did not take effect or the cause is different. First, confirm from the Hikari MBean or the hikaricp_connections_max_lifetime-style metrics that the running Pods have the new values, since pool settings from a ConfigMap only apply after a restart. Then look at what the borrowers are doing: a thread dump when pending connections is high shows whether threads are inside a socket read, which means a dead or slow database, or inside application code holding a connection, which means a transaction that does slow work while holding the connection, and the Pod move was a coincidence. Then check the database side: pg_stat_activity for connections from the old Pod IPs that the database still counts, which can exhaust max_connections so new connections are refused; the new Postgres Pod inherits nothing, but PgBouncer in front might. Each of those has a different fix.

"Would PgBouncer have prevented this, and what would it have changed?"

Partly. With PgBouncer as a Deployment in front of the database, the application's pool connects to PgBouncer, which stays up through a database Pod move, so the application's sockets are never to the dead peer; PgBouncer's own server connections die, and it reconnects to the new primary through the Service quickly because it has short server-side timeouts, server_connect_timeout and server_login_retry. In-flight transactions at the moment of the move still fail and must be retried by the application. What it changes is that the application's connection settings matter less and the failover is handled in one place for every service. The costs are one more hop of a few hundred microseconds, the pooling mode decision, transaction pooling breaks session state such as prepared statements and advisory locks, and PgBouncer itself needing replicas and a PDB.

Q122. "Why do Kubernetes Events disappear after an hour, what does that mean for incident investigation, and what do you do about it?"

Reveal answer

Strong answer Events are ordinary objects in etcd — one per occurrence with a count and timestamps — and because a busy cluster generates thousands an hour, the API server gives them a time-to-live of one hour by default (--event-ttl) to keep etcd small. So an OOMKilled, FailedScheduling, or Killing event from a 3 a.m. incident is gone by the time anyone looks at 9 a.m., and kubectl describe shows a clean history that never happened. The Pod's status keeps some of it — lastState with the last termination reason and restart count — but not the sequence, and not for Pods that were deleted. What to do: export events as they happen. An event exporter (kube-events-exporter, or the OpenTelemetry Collector's Kubernetes events receiver) watches the Events API and ships every event to the log store with the same retention as logs, so an incident timeline is a query: every event for this namespace between 02:50 and 03:20. Pair it with kube-state-metrics, which converts state transitions into time series — restarts, phase changes, conditions — that survive in Prometheus with full history. The pattern to remember for the interview: Events answer "what did the control plane say about this object" and vanish; metrics answer "what was true over time" and persist; both are needed, and the first must be exported before you need it.

Land it Events are the control plane's narration with a one-hour memory — export them to the log store, or the 3 a.m. story will not exist by morning.

Likely follow-ups
"Why not just raise the event TTL to a week?"

Because events are stored in etcd, and etcd is the cluster's most sensitive component. A busy cluster produces tens of thousands of events an hour, each a few kilobytes; a week's worth is millions of objects and gigabytes in a store that should stay under a few gigabytes for latency and that has an 8 GiB default quota, beyond which it goes read-only. Listing or watching events would also become slow for every tool that reads them. The --event-ttl flag exists and managed providers usually do not expose it. So the TTL is a protection, and the right store for history is the log system, which is built for volume and retention. The one thing worth doing on the cluster side is the API server's event rate limiting so a misbehaving controller cannot flood etcd in the first place.

"How would you configure the export concretely, and what do you do about volume?"

The OpenTelemetry Collector's k8sobjects receiver in watch mode on the events.k8s.io API, running as a single-replica Deployment with a lease, exporting to the log pipeline with the same labels as Pod logs: namespace, involved object kind and name, reason, and type. Or the kubernetes-event-exporter project with a sink to Loki or Elasticsearch. Volume: most events are repeats, and the exporter can deduplicate by the event's count and last timestamp; I also drop the noisiest normal-type reasons at the collector, Pulled, Created, Started, Scheduled, keeping every Warning and the lifecycle reasons that matter, Killing, Evicted, FailedScheduling, Unhealthy, BackOff. That reduces it to a small fraction of the log volume and keeps the events that appear in incident timelines.

"Which metrics from kube-state-metrics substitute for events, and where do they fall short?"

kube_pod_container_status_restarts_total and kube_pod_container_status_last_terminated_reason give restarts and the reason, including OOMKilled; kube_pod_status_phase and kube_pod_status_ready show phase transitions; kube_node_status_condition shows pressure and readiness over time; kube_deployment_status_replicas_unavailable shows a rollout failing. They fall short on the narrative: a metric says the Pod restarted at 03:02 with reason OOMKilled, but not that it was evicted for disk pressure first, or which scheduling filter kept it Pending, or the probe failure message with the HTTP status. They also cannot represent one-off objects that were deleted, since the series ends. So metrics give the "what and when" for alerting and graphs, and exported events give the "why" for the write-up.

"An incident happened last night and events are gone. What can you still recover?"

Quite a lot. The Pod's status.containerStatuses[].lastState.terminated holds the last exit code, reason, and timestamps if the Pod still exists; kubectl logs --previous holds the previous container's log if the Pod has restarted only once since. The API server audit log, if enabled and shipped, records every write, including who deleted what and when. Prometheus has the metrics above with full resolution for the period. The application logs are in the log store. The kubelet's journal on the node, journalctl -u kubelet --since "03:00", records eviction decisions, probe failures, and image pulls in more detail than events ever did, and it survives the hour, so a node debug session recovers that unless the node was replaced. The one that is truly gone is the scheduler's reasoning for a Pending Pod, which is why the exporter goes in before the next incident.

Q123 · Scenario. "The public gateway returns a burst of 502s for about 20 seconds, roughly every 30 to 40 minutes, all day. No deploys. Backends look healthy. Find it."

Reveal answer

The real test Whether you look for a periodic control-plane action rather than an application cause.

Strong answer Diagnosis order: a regular period with no deploys means something scheduled or reactive is happening on that cadence. Evidence: overlay the 502 bursts with Kubernetes events (exported, as the previous question insists), node counts, and the gateway proxy's Pod lifecycle — restarts, terminations, or endpoint changes at those moments. Ranked causes. One: the cluster autoscaler scaling in. Every time a node has been under-utilised for the default 10 minutes, the autoscaler drains it; if a gateway proxy Pod lives on that node and the proxy Deployment has no PDB and no preStop delay, the Pod is terminated while the cloud load balancer still targets it for one health-check cycle — 502s until the load balancer notices. The period matches nodes being added for a burst and removed after cool-down. Two: a periodic certificate or configuration reload in the proxy that restarts workers — less likely to produce 502 rather than reset. Three: the proxy's HPA scaling down on the same cadence with the same missing graceful shutdown. Four: a CronJob every 30 minutes whose Pods land on the gateway's nodes and cause memory pressure eviction. Fix: give the gateway Deployment a PDB with minAvailable covering at least two Pods, a preStop sleep longer than the load balancer's health-check window, the autoscaler annotation cluster-autoscaler.kubernetes.io/safe-to-evict: "false" as a belt-and-braces, and place gateway proxies on the system pool the autoscaler does not scale in aggressively. Prevention: treat entry proxies as critical infrastructure with the same protections as CoreDNS, and a dashboard that plots node count against error rate so the correlation is visible.

Land it Periodic errors with no deploys are the autoscaler tidying up under a Pod with no disruption budget — the gateway needs a PDB and a drain delay like anything else that fronts users.

Likely follow-ups
"You added the PDB and preStop and the bursts continue, now every 45 minutes. What next?"

The period changed, which suggests I affected the timing without removing the cause, or the cause is a different periodic actor. I go back to the overlay: node count, gateway Pod lifecycle, and now also the load balancer's own target health history from the cloud console, the certificate controller's activity, and CronJob schedules. Possibilities: the autoscaler is still scaling in nodes that host a different component in the path, such as the external DNS controller or a NodePort-bound proxy that is not the gateway Deployment I protected; the cloud load balancer's target registration is flapping because the readiness gate is missing; or the proxy hot-reloads on a 45-minute certificate renewal and the reload drops connections, which Envoy handles gracefully but nginx-based proxies can mishandle with long-lived connections. The proxy's access log at the burst moment, with the upstream error reason, distinguishes "no upstream" from "connection reset".

"What does safe-to-evict false actually do, and what is the trade-off?"

The annotation cluster-autoscaler.kubernetes.io/safe-to-evict: "false" on a Pod tells the Cluster Autoscaler that a node hosting this Pod must not be scaled down; Karpenter honours the equivalent karpenter.sh/do-not-disrupt: "true". It does not affect kubectl drain, node upgrades, or preemption; only the autoscaler's consolidation. The trade-off is that a Pod with it pins its node forever, so three gateway replicas pin three nodes, which is acceptable for a critical proxy but becomes a cost problem if teams copy the annotation onto ordinary services. That is why I prefer the PDB and the graceful shutdown as the primary fix, and reserve the annotation for a short list, the gateway and the monitoring stack, ideally placed on the system pool where scale-in is disabled anyway.

"How would you have seen this in monitoring before anyone reported it?"

The gateway's 5xx rate alert should have fired at the first burst, and if it did not, the threshold was set for sustained errors rather than bursts; a burn-rate alert with a short window, 5xx above 5 percent over two minutes, catches 20-second bursts. The correlation panel is the diagnostic one: node count from kube-state-metrics on the same graph as the gateway error rate. A step down in node count aligned with each burst is the picture that ends the investigation. Also worth having: a per-Deployment "Pods terminated by node drain" counter, derived from exported events with reason Killing and the drain's eviction message, which would have shown the gateway losing a replica every 30 to 40 minutes. Those three panels turn a day of hunting into ten minutes.

"How do you decide the preStop sleep, and what does it cost during a normal rollout?"

The sleep must cover the slowest thing that still routes traffic to the Pod after it starts terminating: for a cloud load balancer targeting nodes, the health-check interval times the unhealthy threshold, often 20 to 30 seconds; for a load balancer targeting Pod IPs with a readiness gate, the deregistration delay, which is configurable and can be 10 seconds; for in-cluster traffic, kube-proxy propagation, a few seconds. So typically 15 to 30 seconds, and terminationGracePeriodSeconds must exceed sleep plus the application's own drain. The cost is rollout time: each replica takes that many extra seconds to terminate, so a 20-replica proxy with maxUnavailable: 1 gains ten minutes on a rollout. That is acceptable for a proxy that deploys weekly, and maxSurge keeps capacity up during it.

Q124 · Design. "Design the Kubernetes-layer alert set for a platform team's on-call: which alerts page, which only ticket, and the runbook shape for the paging ones."

Reveal answer

Strong answer Requirements: page only for conditions that need a human now, ticket the rest, and give every page a first step that is not "look around". Pages (platform): API server error rate or p99 latency over threshold for 5 minutes; etcd fsync p99 above 25 milliseconds or a leader change; more than one node NotReady, or any node NotReady for over 10 minutes; CoreDNS error rate or fewer than two Ready replicas; a CNI or kube-proxy DaemonSet with Pods not Ready on any node; cluster allocatable capacity above 90 percent requested; a node pool at maximum size with Pending Pods; an admission webhook failing or slow; the gateway proxy below its minimum replicas; certificate expiry within 7 days. Pages (team-owned, routed by namespace): a Deployment below its desired available count for 10 minutes; a Pod restarting more than 3 times in 15 minutes; a StatefulSet Pod Pending or Terminating for 5 minutes; an SLO burn-rate alert. Tickets: Pods Pending under 15 minutes, CPU throttling above 25 percent, working set above 85 percent, HPA at maximum for an hour, PDB with zero allowed disruptions, Jobs failing, deprecated API usage, VPA recommendations diverging from requests, and cost anomalies. Runbook shape for each page, one screen long: what the alert means in one sentence; the first command to run (for NotReady: kubectl describe node and check the cloud console); the three likely causes in order with the check for each; the mitigation that is always safe (cordon and drain, scale up, pause the autoscaler); the escalation; and a link to the last three incidents that fired it. Alerts carry the runbook link and the namespace's team from a label, so the right person is paged without the platform team triaging. Trade-offs: team-routed alerts require every namespace to carry an owner label, enforced at admission. What I would not do: page on CPU utilisation, page the platform team for application restarts, or ship alerts without a runbook.

Land it Page on control-plane health, node loss, cluster plumbing, and capacity; ticket the drift; route application alerts to owners by label; and never let an alert fire without its first command written down.

Likely follow-ups
"Write the PromQL and the runbook first step for the 'Deployment below desired for 10 minutes' page."

The expression: kube_deployment_status_replicas_available < kube_deployment_spec_replicas, with for: 10m, joined on namespace and deployment, and labelled with the team from kube_namespace_labels so Alertmanager routes it. Ten minutes is chosen so that a normal rollout, which briefly lowers available replicas, does not page. The runbook's first command: kubectl get pods -n $ns -l app=$deployment and kubectl describe the one that is not Ready, because the status column names the state, Pending, ContainerCreating, CrashLoopBackOff, or Running but not Ready, and each has its own next step from the incident walk. The always-safe mitigation is to check whether the previous ReplicaSet is healthy and roll back with kubectl rollout undo if a deploy caused it. Escalation is the owning team, already paged by the label.

"Why not page on CPU utilisation, and what do you page on instead for capacity?"

CPU utilisation is a symptom without an action: a node at 90 percent CPU may be perfectly healthy for a batch pool and a disaster for a latency-sensitive one, and the responder cannot do anything with the number alone. Paging on it trains people to acknowledge and ignore. For capacity I page on consequences and on ceilings: Pods Pending for more than five minutes with an unschedulable condition, which means work is not running; a node pool at its maximum size with Pending Pods, which means the autoscaler cannot help; and cluster requested capacity above 90 percent of allocatable, because that is the point where a single node loss cascades. Utilisation goes on a ticket as a right-sizing input and on a dashboard as context, never on a pager.

"How do you keep alerts from becoming noise over a year?"

With a feedback loop that has an owner. Every page gets a one-line disposition in the incident tool: actionable, not actionable, or duplicate. Monthly, the platform team reviews the pages that were not actionable and either raises the threshold, adds a for duration, converts it to a ticket, or deletes it; an alert that has fired ten times without an action is deleted by default. New alerts start as tickets for two weeks before being promoted to pages. Alert rules live in Git with a required runbook link, enforced by a CI check that the URL resolves. And the on-call report each week shows pages per shift; above a handful per night is treated as a platform bug, not a staffing problem. The rule set stays at roughly the size on the previous slide because things leave it as often as they join.

"How do you route an application alert to the right team without the platform team in the middle?"

Every namespace carries an owner label set by the tenant template, and kube-state-metrics exports it as kube_namespace_labels{label_owner="checkout"}. The alert rule joins on namespace to add the owner label to the alert, and Alertmanager's routing tree matches on owner to the team's receiver, PagerDuty service or Slack channel, defined per team in a values file each team maintains. A catch-all route for alerts without an owner label goes to the platform team, and the count of those is itself a ticket. Teams can add their own SLO rules through a PrometheusRule object in their namespace, which the operator picks up, but the routing and the platform alerts are not editable by them. The admission policy requiring the owner label on every namespace is what makes the scheme complete.

Drill · Nodes, clusters & cost

This group tests the layer under the workloads — what happens when a node or a zone fails, what adds and removes capacity, and what all of it costs.

Q125 · Scenario. "A node went NotReady four minutes ago and the cluster has begun evicting its Pods; now other nodes are hitting memory pressure and evicting too. Walk me through stabilising it."

Reveal answer

Strong answer I would proceed in this order:

  1. Understand the cascade. The Node controller marked the node unreachable after 40 seconds and, after the 5-minute toleration, deletes its Pods; their controllers recreate them on other nodes. Those nodes were already near their memory allocatable, and the refugees push them over the kubelet's eviction threshold, so they evict their lowest-QoS Pods, which are recreated elsewhere — a chain reaction. Evidence: kubectl get nodes, kubectl get events -A --field-selector reason=Evicted, and per-node memory pressure conditions.
  2. Stop the spread. Add capacity immediately: raise the node group's desired size by hand rather than waiting for the autoscaler, or un-cordon any spare nodes. If capacity cannot come fast, reduce demand: scale down non-critical Deployments (batch, internal tools) so their memory is freed, using PriorityClass as the guide to what is expendable. Do not restart nodes under pressure — that adds refugees.
  3. Protect the critical. Confirm CoreDNS, the gateway, and the CNI DaemonSet are Ready everywhere; if CoreDNS was evicted, that explains any new failures and it is fixed first.
  4. Deal with the dead node. If the instance is gone, delete the Node object so stuck Terminating Pods and volume attachments clear; if it is alive but partitioned, fence it before deleting anything.
  5. Ranked root causes. The cluster ran above 85–90 percent requested with no headroom for one node's loss; memory requests far below usage, so nodes were overcommitted in reality even if not on paper; BestEffort Pods present on production nodes; no PDBs and no priority ladder to make eviction order sane.
  6. Prevention. Capacity headroom of at least one node per zone (N+1), enforced by an alert; request-equals-limit on memory; priority classes; the over-provisioning placeholder Deployment; and a chaos exercise that kills a node monthly.

Land it Add capacity or shed low-priority load before anything else — the cascade is a capacity problem wearing an eviction costume, and N+1 headroom is the design that prevents it.

Likely follow-ups
"You raised the node group's desired size and the new nodes are not joining. What next?"

Capacity that does not arrive is the worst moment, so I switch to demand reduction while I chase it. For the nodes: check the cloud's instance launch status, since insufficient capacity for the instance type in that zone or a hit quota is common during a regional event; check whether the new instances registered as Nodes at all, which fails on IAM or bootstrap problems; and check whether they are Ready, which fails if the CNI DaemonSet cannot schedule or is version-incompatible. Meanwhile: scale down the lowest PriorityClass workloads, pause any CronJobs, and, if the cluster has one, delete the over-provisioning placeholder Deployment so its reserved capacity is released immediately. I also try a different instance type or zone in a second node group, because the fastest capacity is often the one you were not planning to use.

"Why did memory pressure cascade but CPU pressure would not have?"

CPU is compressible: when a node is oversubscribed, the kernel scheduler slows everyone down proportionally, latency rises, but nothing is killed and no Pod moves. Memory is not: when a node's working set approaches its allocatable, the kubelet's eviction thresholds fire and Pods are terminated, and each terminated Pod is recreated on another node, adding demand there. So memory pressure converts into Pod movement, and Pod movement converts into memory pressure elsewhere, which is the chain reaction. The design consequences: memory requests must be honest, equal to limits for JVMs so the scheduler's arithmetic matches reality; BestEffort Pods must not exist on production nodes because they are evicted first and then land elsewhere; and headroom is calculated on memory, not CPU.

"How does the over-provisioning placeholder work, and how big should it be?"

A Deployment of Pods that request real resources but run a pause container, at a PriorityClass with a negative value. The scheduler places them and reserves their capacity; when a real Pod cannot fit, the scheduler preempts a placeholder, which is instantly evicted, the real Pod takes its place, and the placeholder becomes Pending, which triggers the autoscaler to add a node for it in the background. So the cluster always has warm capacity without a human deciding. Size it to the largest expected sudden demand that must not wait for a node: at least one node's worth per zone, so a node loss is absorbed instantly, and for the JVM startup design earlier, the burst headroom the HPA needs. It costs that capacity permanently, which is the price of N+1; the alternative is the cascade above.

"What did the priority ladder do here, and what would have happened without one?"

With PriorityClasses, the kubelet evicts by usage over request first, then by lower priority, so under pressure the batch and internal tools go before the customer-facing services, and the scheduler, when placing refugees, preempts lower-priority Pods to fit higher ones. That turned the cascade into a controlled shedding of expendable work, and it is also the rule I used by hand when scaling down. Without a ladder, every Pod is priority zero, eviction order depends only on usage versus request, so a well-behaved checkout Pod slightly over its request goes before a batch Pod under its request, and refugees from the critical tier sit Pending behind batch work. The ladder is three classes, system, production, and batch, set by the platform chart from the namespace's tier label, and it is cheap to have before the day you need it.

Q126. "Cluster Autoscaler versus Karpenter — how does each decide to add and remove nodes, and which would you choose for a new cluster?"

Reveal answer

Strong answer The Cluster Autoscaler works with node groups you pre-define — an autoscaling group per instance type and zone. When Pods fail scheduling for resource reasons, it simulates adding one node of each group, picks a group whose node would fit the Pods (by an expander strategy: least waste, priority, random), and asks the cloud to grow that group. It removes a node when it has been below a utilisation threshold (50 percent by default) for 10 minutes, every Pod on it can be moved (respecting PDBs, no local storage, no safe-to-evict: false), and the Pods would fit elsewhere; it drains and then terminates. Its limits are the groups: a Pod needing an unusual shape stays Pending unless you predefined a group for it, and it scales one group at a time. Karpenter has no groups. It reads Pending Pods' requirements — CPU, memory, zone, architecture, GPU, taints — and provisions the cheapest instance types from a list of constraints in a NodePool, directly through the cloud API, usually in about a minute, batching Pods to pick a node that fits several. It consolidates continuously: it will replace two half-empty nodes with one, or a large node with a cheaper one, when doing so is possible within PDBs, and it handles spot interruption notices by pre-emptively draining. It also expires nodes after a configured age, which doubles as an automatic node-rotation for patches. For a new cluster on AWS or Azure I would choose Karpenter for the provisioning speed, the cost consolidation, and the removal of node-group management; on GKE, the native node auto-provisioning covers similar ground. The Cluster Autoscaler remains right where Karpenter is unavailable, and it is simpler to reason about when the fleet is a handful of fixed shapes.

Land it The Cluster Autoscaler grows groups you designed; Karpenter designs the node from the Pod — for a new cluster, let the Pods design the nodes.

Likely follow-ups
"Write a Karpenter NodePool for a general on-demand pool and explain the fields that matter."

A minimal production shape:

apiVersion: karpenter.sh/v1
kind: NodePool
metadata: {name: general}
spec:
  template:
    spec:
      nodeClassRef: {group: karpenter.k8s.aws, kind: EC2NodeClass, name: default}
      requirements:
      - {key: karpenter.sh/capacity-type, operator: In, values: ["on-demand"]}
      - {key: karpenter.k8s.aws/instance-category, operator: In, values: ["m", "r"]}
      - {key: karpenter.k8s.aws/instance-size, operator: NotIn, values: ["nano","micro","small","medium","large"]}
      - {key: kubernetes.io/arch, operator: In, values: ["amd64"]}
      expireAfter: 720h
  disruption:
    consolidationPolicy: WhenEmptyOrUnderutilized
    consolidateAfter: 5m
    budgets: [{nodes: "10%"}]
  limits: {cpu: "2000", memory: 8000Gi}

The requirements keep the pool broad so the cheapest fit is always available while excluding tiny instances that JVMs suffer on; expireAfter rotates nodes monthly for patches; consolidateAfter stops churn; the budget caps how many nodes can be disrupted at once; and limits is the spending ceiling.

"Karpenter's consolidation is replacing nodes constantly and rollouts never settle. What do you do?"

That is consolidation working too eagerly. First, set consolidateAfter to a value such as 10 or 15 minutes so a node must be underutilised for that long before replacement, which absorbs the normal ebb after a deploy. Second, add a disruption budget: budgets: [{nodes: "1"}] or a percentage, and a schedule that disables consolidation during deploy hours or business hours with the schedule and duration fields. Third, make sure every Deployment has a PDB, because Karpenter respects them and a Pod without one is fair game at any moment. Fourth, mark truly sensitive Pods with karpenter.sh/do-not-disrupt: "true". And check expireAfter is not too short. The metrics to watch are karpenter_voluntary_disruption_decisions_total by reason; a high consolidation count with a low saving per decision is the signature.

"How does the Cluster Autoscaler pick between node groups, and where does that go wrong?"

Through the expander, set with --expander. random picks any group that fits; most-pods picks the group whose node would schedule the most Pending Pods; least-waste picks the group whose node leaves the least idle CPU and memory after placing them; priority uses a ConfigMap of regular expressions to rank groups, which is how you prefer spot over on-demand; and expanders can be chained. It goes wrong when a group's launch template does not match the taints and labels the autoscaler was told to expect, so the simulation says a Pod fits but the real node rejects it, and the autoscaler keeps adding nodes that stay empty; when a group is at its maximum and the autoscaler does not try the next one quickly; and when every group is a single instance type in a single zone, so a capacity shortage in the cloud stalls the whole cluster.

"What does node expiry buy you, and what does it risk?"

Expiry, Karpenter's expireAfter or a managed node pool's maximum node age, replaces every node on a schedule with a fresh one from the current image, which delivers kernel and runtime patches without a separate upgrade project and prevents the drift of long-lived nodes, leaked files, stale caches, and forgotten manual fixes. It also proves continuously that the cluster tolerates node replacement, so a real node loss is a routine event. The risk is that it is a rolling disruption of everything, so it exposes every missing PDB, every short grace period, and every StatefulSet that dislikes movement; and if the new image is broken, expiry rolls the breakage across the fleet at the budget's pace. So expiry runs with a budget of one or two nodes at a time, outside peak hours, and the node image is pinned and canaried before it becomes the default.

Q127 · Scenario. "The cluster has been at 30 nodes for two weeks, at 35 percent average utilisation, and the Cluster Autoscaler never removes any. Find out why."

Reveal answer

Strong answer Diagnosis order: the autoscaler removes a node only when it can safely move every Pod on it, so something on every node is unmovable. Evidence: the autoscaler's status ConfigMap (cluster-autoscaler-status in kube-system) and its logs list each node it considered and the reason it is not a scale-down candidate — that is the diagnosis. Ranked causes. One: utilisation is measured by requests, not usage — 35 percent usage may be 80 percent requested, above the 50 percent threshold, on every node. Two: Pods that block eviction on each node: kube-system Pods without a PDB (the autoscaler refuses to evict them by default), Pods with local storage (emptyDir counts unless --skip-nodes-with-local-storage=false), Pods not owned by a controller, Pods annotated safe-to-evict: "false", or Pods whose PDB allows zero disruptions. A DaemonSet does not block, but a single monitoring agent deployed as a Deployment with a hostname spread does. Three: the Pods could be evicted but would not fit elsewhere by request arithmetic. Four: the autoscaler's scale-down is disabled or its cool-down after a scale-up is long. Fix: right-size requests (VPA recommendations), add PDBs to the system Pods so the autoscaler is permitted to move them, mark scratch emptyDir Pods as safe to evict, remove orphan Pods, and consider Karpenter's consolidation, which is more aggressive and explains itself better. Prevention: an alert on the gap between requested and used per node, and a weekly report from the autoscaler status of the top reasons nodes are pinned.

Land it The autoscaler is refusing for a reason it writes down in its status — usually inflated requests and a few unmovable Pods per node — and fixing those is worth more than any instance discount.

Likely follow-ups
"You fixed the PDBs and emptyDir annotations and it still will not scale down. What next?"

Back to the status ConfigMap, because it names the blocker per node and I should not guess. Remaining candidates: the utilisation threshold, --scale-down-utilization-threshold, defaults to 0.5 by requests, and if every node is above 50 percent requested, nothing qualifies regardless of PDBs; DaemonSet requests count toward it on some versions. Scale-down may be disabled by --scale-down-enabled=false, or delayed by --scale-down-delay-after-add of ten minutes that resets on every scale-up, which in a cluster that scales up somewhere every few minutes means never. A node group at its minimum size cannot shrink. And nodes with the annotation cluster-autoscaler.kubernetes.io/scale-down-disabled: "true", which someone may have added during an incident and forgotten. Each one is a line in the status output or a flag in the autoscaler's Deployment.

"How do you reconcile 35 percent usage with 80 percent requested, and what is the actual fix?"

The gap is padding: developers set requests for the worst case they can imagine, and the scheduler reserves that whether or not it is used. The actual fix is right-sizing, and it needs data, not persuasion. VPA in recommendation mode across every Deployment produces a target per container from a week of observed usage; a report ranking services by requested minus recommended, multiplied by replicas, shows where the waste is, and typically ten services account for half of it. Pull requests for those ten, cutting CPU requests to about the p95 of usage, and memory to the p99 plus a margin, then watching for throttling and OOM. After that the nodes drop below the threshold and the autoscaler removes them on its own. The LimitRange's maxLimitRequestRatio and a quota per team then keep the padding from returning.

"Would Karpenter have behaved differently here?"

Partly. Karpenter's consolidation is also request-based, so the padding problem is the same; it would not remove nodes whose requested capacity cannot fit elsewhere. But it is more aggressive on the mechanics: it considers replacing a node with a cheaper one, not only removing it; it does not have the 50 percent threshold or the ten-minute reset after every scale-up; it explains its decisions in events on the node with the exact reason; and it treats kube-system Pods like any other, so a PDB-less system Pod does not pin a node forever. So the same cluster under Karpenter would likely have shrunk somewhat, and the remaining waste would still be request padding. Karpenter is a better tool; it is not a substitute for honest requests.

"What alert or report stops this from lasting two weeks again?"

Two things. An alert on the cluster-wide ratio of used to requested, sum(rate(container_cpu_usage_seconds_total[1h])) / sum(kube_pod_container_resource_requests{resource="cpu"}), below 0.4 for a day, which is a ticket to the platform team titled "requests are padded". And a weekly report generated from the autoscaler's status ConfigMap, or from Karpenter's events, counting the top reasons nodes were not scale-down candidates; if "PDB" or "local storage" tops the list, the fix is a template change, and if "utilisation above threshold" tops it, the fix is right-sizing. Cost per namespace from OpenCost on each team's dashboard makes the padding visible to the people who wrote it, which is the pressure that lasts.

Q128 · Design. "Design the cluster layout for 200 services across three teams: how many clusters, which node pools, which namespaces, and what lives where."

Reveal answer

Strong answer Requirements: production isolation from non-production, team autonomy, blast-radius limits, and an operational load one platform team can carry. Design: three clusters per region, not per team — prod, staging, and dev — because environments differ in risk and change rate, while teams differ only in ownership, which namespaces express. Production is two clusters in an active-active pair if the availability target demands it (see the multi-region question); otherwise one, spanning three zones. Within each cluster, namespaces per team per domain: with 200 services and three teams, roughly 15–25 namespaces grouping related services (a team's "checkout" and "catalogue" domains), each stamped from the tenant template — Pod Security, network baseline, quota, RBAC to the team's group. Not one namespace per service (700 policies and quotas to maintain) and not one per team (no quota granularity between a team's critical and experimental work). Node pools: a system pool for cluster plumbing; a general pool of memory-optimised on-demand instances across zones for services; a batch pool of spot compute instances, tainted; and special pools only where a workload needs them (GPU). Shared platform services — the gateway, the monitoring stack, cert-manager, the External Secrets Operator, Argo CD — live in infra namespaces managed only by the platform team, deployed from a platform GitOps repository. Data stores are managed cloud services outside the cluster, referenced by ExternalName Services. Cross-team calls go through in-cluster Services with NetworkPolicies that name the allowed caller namespaces, so a dependency is visible as a policy line. Trade-offs: one production cluster is one blast radius for a bad control-plane upgrade, which is why staging runs the new version first for a week; separate clusters per team would triple the platform load for isolation that namespaces and pools already give internal teams. What I would not do: a cluster per team, a cluster per environment per team, or mixing dev workloads into the production cluster "to save money".

Land it Clusters split by environment, namespaces split by team and domain, pools split by workload shape — and the platform's own services live in a namespace no team can touch.

Likely follow-ups
"Requirement change: one of the three teams handles regulated data and needs a separate audit trail. Cluster or namespace?"

I would start with the namespace-and-pool answer and test it against the regulator's actual requirement. A dedicated tainted node pool, a namespace group with cluster-scoped deny policies, RBAC with no shared group membership, and the audit log filtered by namespace shipped to their own retention bucket gives a separate audit trail at the API level. Where that fails is the control plane: cluster admins and the shared audit log configuration are the same for everyone, and if the regulator requires that no one outside the regulated team can administer the environment, a separate cluster is the only honest answer. So the decision hinges on one question to the compliance owner: is the boundary about data access, which namespaces can prove, or about administrative control, which only a cluster can. I would price both and let the answer to that question pick.

"Why namespaces per team per domain rather than per service, in numbers?"

Every namespace carries the tenant stamp: at least a default-deny policy, a DNS allow, a quota, a LimitRange, two RoleBindings, and Pod Security labels, roughly eight objects plus a GitOps directory. Per service that is 200 namespaces and 1,600 platform objects to keep correct, and every cross-service call crosses a namespace boundary that needs a policy pair, so a domain with ten chatty services needs 90 policy rules instead of none. Per team it is three namespaces and no granularity: the team's experimental batch job and its checkout service share one quota and one blast radius. Per domain, 15 to 25 namespaces, gives quota and policy at the level where the ownership and the traffic actually cluster, and intra-domain calls need no policy. The count is a compromise, and I would revisit it if a domain grew past 20 services.

"How do you keep staging genuinely identical to production without paying for it twice?"

Identical in shape, not in size. The same Terraform module builds both, with variables only for node counts, instance sizes, and replica minimums, so every add-on, version, policy, and network rule is the same code. The same GitOps repositories deploy to both with per-environment values, so a manifest difference is a diff in one file. Staging runs the new Kubernetes version and add-on versions a week ahead, which is its main purpose. Where it saves money: smaller and fewer nodes, spot instances for the general pool, scale-to-near-zero at night, and shared managed databases with synthetic data. What it must not cut: the same CNI, the same policy engine, the same Gateway implementation, and the same multi-zone layout, because those are exactly the things whose bugs staging exists to find.

"What would you cut under time pressure to have the first cluster in a month?"

Ship production and dev only, with staging as a promise for month two, because a dev cluster gives a place to try upgrades even if it does not resemble production in size. Ship one general pool plus a system pool, and add the batch and GPU pools when a workload needs them. Start with the namespaces of the first team's domains and let the template create the rest on demand. Defer the active-active production pair. What I would not cut: three zones for the production cluster, because retrofitting zone spread is painful; the system pool separation, because a monitoring stack on the workload pool is the first thing to fall over; the tenant template, even if it is a Kustomize directory; and managed data stores outside the cluster, because moving a database later is a project of its own.

Q129 · Design. "Finance says the Kubernetes bill is 40 percent higher than the workloads justify. Design the six-week programme to cut it without an outage."

Reveal answer

Strong answer Requirements: measurable savings, no availability regression, and changes that stick. Week 1, measure: install OpenCost or Kubecost to attribute node cost to namespaces by request share, and compare requests with usage per Deployment from Prometheus; the gap between requested and used, per team, is the report. Typically the finding is that requests are two to three times usage and the cluster is 45 percent utilised. Weeks 2–3, right-size: VPA in recommendation mode across the fleet, then pull requests to the GitOps repository per service in batches of 20, ordered by waste, cutting CPU requests to the p95 of usage and memory to the p99 plus 20 percent, with limits following; each batch deploys through the normal canary path and is watched for throttling and OOM for 48 hours before the next. Week 4, consolidate: move to Karpenter or enable aggressive consolidation, add PDBs to the system Pods that pin nodes, switch the batch pool and any stateless, PDB-protected, gracefully-shutting-down services to spot instances (30–70 percent cheaper) with a node termination handler, and buy savings plans or committed-use discounts for the on-demand floor now that the floor is known. Week 5, schedule: scale dev and staging to near zero outside working hours with a KEDA cron scaler or a simple scheduled job, and set scale-to-zero on idle internal tools with KEDA or the HPA's scale-to-zero (beta in 1.37). Week 6, lock in: a LimitRange maximum ratio so requests cannot be padded, a ticket for any service whose VPA recommendation diverges by more than 30 percent, cost per namespace on each team's dashboard, and a monthly review. Expected outcome: 30–40 percent from right-sizing and consolidation, another 10–20 percent from spot and commitments. Trade-offs: tighter requests reduce burst headroom, so the right-sizing pull requests preserve headroom for latency-sensitive services and the acceptance criteria include p99 latency, not just cost. What I would not do: add CPU limits to "control cost", cut replicas below zone-failure tolerance, or do it all in one week.

Land it Measure the request-to-usage gap, close it in reviewed batches, let the autoscaler consolidate what you freed, then commit to the floor — and make the drift visible so it cannot quietly return.

Likely follow-ups
"After week three, right-sizing has caused two OOM incidents and a team is refusing further changes. What do you do?"

I look at why the two incidents happened before arguing. Both are probably the same mistake: memory cut to the p99 of a window that did not include the monthly batch or a traffic peak, or a JVM whose heap was set by percentage and did not shrink with the limit. The correction is to compute memory recommendations over a window that includes the service's known peaks, at least 30 days, keep the plus-20-percent margin, and check that -XX:MaxRAMPercentage leaves room for non-heap memory. Then I change the process rather than pushing harder: memory cuts require the owning team's approval with the recommendation and the data attached, CPU cuts proceed because throttling is recoverable and OOM is not, and every change ships with an automatic rollback if OOM kills or throttling rise within 48 hours. The programme loses a week and keeps its credibility.

"What is the actual saving from spot, and what workloads must never go on it?"

Spot instances are 60 to 90 percent cheaper than on-demand list price, with the catch that they can be reclaimed on two minutes' notice and that capacity for a given type can vanish in a zone for hours. For a batch pool with diversified types across zones, the effective saving after a small on-demand fallback is typically 50 to 70 percent of that pool's cost. Never on spot: anything with a ReadWriteOnce disk that cannot detach inside the warning window, stateful quorum members, the gateway and the monitoring stack, and any service whose shutdown plus PDB arithmetic means a correlated reclamation takes it below its zone-failure minimum. Stateless services with PDBs and graceful shutdown can run partially on spot, with a mixed pool of, say, 30 percent on-demand as the floor.

"How do you present the result to finance so it holds up?"

With one number they can verify and one they cannot game. The verifiable one is the cloud bill's compute line for the cluster's node groups, month over month, with the savings plan commitments shown separately so the "before" is not inflated by them. The one that protects the engineering side is cost per unit of work, cost per thousand requests at the gateway and cost per Job for batch, because the bill can rise with traffic while efficiency improves, and finance needs to see that distinction before the next growth quarter. I add two guard metrics, p99 latency for the top services and the OOM kill count, both unchanged or better, because a saving that degraded the product is one finance will hear about from somebody else. And a forward view: the LimitRange and the monthly review that keep the number from creeping back.

"Why not CPU limits to control cost? People keep suggesting it."

Because limits do not reduce what you pay for. The cloud bills for nodes, and nodes are sized by the scheduler from requests, so a Pod with a 1-core request and a 1-core limit costs exactly the same node capacity as one with a 1-core request and no limit; the difference is only that the second can use idle cycles that were already paid for. Adding CPU limits therefore saves nothing and adds throttling, which raises tail latency and often leads teams to raise requests to compensate, which increases the bill. The one legitimate use is fairness on a shared node where one tenant must not starve others, and even there the request is what the scheduler uses. Cost control is requests, consolidation, and instance choice; limits are a latency decision, and for CPU usually the wrong one.

Q130 · Scenario. "The batch pool runs on spot instances. This afternoon 30 percent of its nodes were reclaimed within five minutes, and three Jobs were marked Failed. What happened and how do you make Jobs survive this?"

Reveal answer

Strong answer Diagnosis order: a correlated spot reclamation is normal behaviour for a pool concentrated in one instance type and zone — the cloud reclaims a whole capacity pool at once. Evidence: the cloud's interruption notices, node deletion events, and the Jobs' Pod failure reasons. The Jobs failed because each reclaimed Pod counted as a failure against backoffLimit (default 6), and with several reclamations per Job plus real retries, the budget ran out; or because a Pod that was mid-task was killed without checkpointing, and the retry started over, exceeding activeDeadlineSeconds. Ranked contributors: a single instance type in the Karpenter NodePool or autoscaling group, so one capacity pool's reclamation hit everything; no node termination handler, so the two-minute warning was wasted and Pods got no graceful shutdown; Jobs without podFailurePolicy; non-idempotent tasks. Fixes: diversify — allow many instance types and all zones so reclamations are uncorrelated; run a termination handler (the AWS node termination handler, or Karpenter's built-in interruption handling) that cordons and drains on the notice so Pods exit cleanly; add a podFailurePolicy with action: Ignore for Pods with the DisruptionTarget condition, so infrastructure kills do not consume backoffLimit; checkpoint progress in the database as the migration question described; and keep a small on-demand fallback in the same pool for the last 10 percent of a deadline-bound run. Prevention: a game day that reclaims a third of the batch pool, and a rule that any Job on spot must declare its failure policy.

Land it Spot punishes concentration and non-idempotence — diversify the instance types, treat disruption as not-a-failure in the Job policy, and checkpoint so a killed Pod costs minutes, not the run.

Likely follow-ups
"Write the podFailurePolicy that ignores disruptions and fails fast on a data error."

On the Job spec, evaluated in order, first match wins:

spec:
  backoffLimit: 6
  podFailurePolicy:
    rules:
    - action: Ignore
      onPodConditions:
      - type: DisruptionTarget
    - action: FailJob
      onExitCodes:
        containerName: worker
        operator: In
        values: [42]
    - action: Count
      onExitCodes:
        operator: NotIn
        values: [0]

The DisruptionTarget condition is set by the kubelet or the eviction API when a Pod is killed by preemption, node drain, or a taint-based eviction, so those failures do not count against the six retries. Exit code 42 is what the worker returns when an invariant is broken, and it fails the whole Job immediately rather than retrying. Everything else counts normally. The Job needs restartPolicy: Never for exit-code rules to see the container's own exit.

"You diversified instance types and it happened again. Why?"

Diversification reduces correlation but does not remove it. Reclamations are per capacity pool, one instance type in one zone, but a regional demand spike can drain many pools at once, and Karpenter or the autoscaler may have concentrated the nodes in the cheapest pool anyway, which is what the default price-optimised allocation does. So I check where the reclaimed nodes actually were; if they were all one type, the diversification did not take effect because the NodePool requirements or the launch template still preferred one. Fixes: the price-capacity-optimized allocation strategy on AWS, which weighs capacity availability, and Karpenter's default behaviour of choosing among the cheapest types that are least likely to be interrupted; a floor of on-demand capacity in the same pool; and checkpointing so that even correlated loss costs minutes of work, not hours.

"How does the termination handler hand the two minutes to the Pod, and what must the Pod do with them?"

The handler receives the interruption notice, from the instance metadata endpoint or an SQS queue fed by EventBridge, cordons the node, and calls the eviction API for each Pod, which respects PDBs and starts the normal termination: preStop hook, SIGTERM, then SIGKILL after terminationGracePeriodSeconds. The Pod's job is to finish or checkpoint inside that grace period: commit the current batch's high-water mark, close its connections, and exit zero, or exit with a code the failure policy treats as a disruption. So the grace period must be under about 100 seconds on AWS to fit the warning, and the batch size must be small enough that a batch completes in that time. A worker that ignores SIGTERM and gets SIGKILLed after the grace period loses the batch and also risks a half-committed state.

"What would you do for a Job that must finish by a deadline regardless of spot?"

Give it an escape to on-demand. The Job's Pods carry a node affinity that prefers spot with a weight but allows on-demand, so when spot capacity is gone the scheduler or Karpenter provisions on-demand. Set activeDeadlineSeconds for the whole Job and track progress so the runbook can tell whether the deadline is at risk; a checkpoint metric per index makes that a query. For the last stretch, a second Job with the same migration identifier and a node selector for on-demand can be launched to finish the remaining ranges, since the checkpoints in the database make that safe. And a PriorityClass above other batch work so a deadline-bound Job preempts speculative jobs rather than waiting behind them. The trade is a higher cost for the final part of the run, which is exactly the cost the deadline justifies.

Q131. "How does a Kubernetes cluster upgrade actually proceed, what does the version skew policy allow, and what breaks most often?"

Reveal answer

Strong answer The order is control plane first, then nodes. On a managed service the provider upgrades the API servers in place with rolling replacement behind the load balancer, then etcd if needed, then the controller manager and scheduler; on kubeadm you do the same one control-plane node at a time. The version skew policy is what makes the node phase safe: the kubelet may be up to three minor versions older than the API server (since 1.28; two before), and kube-proxy may not be newer than the API server, so nodes on 1.34 keep working against a 1.37 control plane while pools are rotated. Node upgrades are done by replacement, not in place: a new node pool (or new nodes in a surge) with the new kubelet joins, old nodes are cordoned and drained under PDBs, then terminated — one node or a percentage at a time. kubectl should be within one minor version of the API server. What breaks most often, in order: removed APIs used by manifests, charts, or operators (the deprecation questions); add-ons and CNI versions incompatible with the new release, especially when the control plane jumps ahead of the DaemonSets; PDBs that block drains; workloads relying on behaviour that changed (a defaulting change, a feature gate flipping); and, on self-managed clusters, certificates and etcd versions. Minor versions cannot be skipped — 1.35 to 1.37 is two upgrades — and each minor is supported for about 14 months, so a cluster needs about three upgrades a year to stay in support, which is why it must be routine rather than a project.

Land it Control plane first, nodes by replacement under PDBs, one minor at a time — and the skew policy is the reason the nodes can lag, not a reason to let them.

Likely follow-ups
"How do you find removed APIs before they bite, concretely?"

Three sources. The API server metric apiserver_requested_deprecated_apis has labels for group, version, resource, and the removal release, and is non-zero for every deprecated API something is still calling, which includes operators and controllers, not just manifests; a dashboard on it shows what will break at the next version. kubent and pluto scan manifests, Helm releases, and the live cluster for objects on deprecated versions. And the audit log with a filter on the deprecated API paths names the exact user agent making the calls, which catches the old client library in a custom controller. The step people miss is Helm release history: Helm stores the manifest it applied, and if a release was last applied with a removed version, helm upgrade after the cluster upgrade fails until the stored manifest is patched with the mapkubeapis plugin.

"What exactly does the skew policy allow, with versions, and where do people misread it?"

The API server is the reference. Other control-plane components, the controller manager and scheduler, may be one minor older than the API server, never newer. kubelets may be up to three minors older than the API server since 1.28, so 1.34 kubelets work with a 1.37 API server, but never newer. kube-proxy must be no newer than the API server and can be three minors older like the kubelet. kubectl within one minor either way. The misreading is thinking the skew is symmetric: a node cannot be upgraded before the control plane, and the control plane cannot be upgraded more than one minor at a time. The other misreading is applying the skew to add-ons: Cilium, cert-manager, and the metrics stack have their own compatibility matrices that are usually narrower, and that is where most upgrade failures originate.

"What is the support window, and what does missing it cost?"

Upstream, each minor version gets about 14 months of patch releases, and three minors are released a year. Managed providers track roughly that: standard support ends about 14 months after a version's release, and as of Aug 2026 EKS and AKS charge an extended-support premium per cluster hour for versions past that, roughly six times the standard control-plane price on EKS, while GKE auto-upgrades clusters on its release channels. Missing the window costs money, and it costs the ability to skip: a cluster three versions behind must go through each version in turn, each with its own deprecations, so the catch-up is three projects instead of one routine. That is why upgrades are a quarterly routine with staging a version ahead, and a cluster older than two minors behind the latest is a tracked risk.

"How would you handle a feature-gate change that alters default behaviour?"

By reading the release notes for the target version's "urgent upgrade notes" and the feature gate table before staging, and by testing behaviour rather than trusting the notes. Examples of the type: a gate that changes how the kubelet enforces memory, cgroup v2 becoming required, a change in how Job failures count, or the sidecar container semantics changing how init containers are restarted. For each one that touches something we use, a targeted test in staging: deploy the workload, exercise the behaviour, compare with production. If the new default is unwanted, most gates can be held at the old value for one or two releases with --feature-gates on self-managed clusters, which buys time; managed clusters do not expose that, which is one more reason to run staging a version ahead.

Q132 · Design. "Design the upgrade procedure for the production cluster from 1.35 to 1.36 with no user-visible impact, including the checks before, during, and after."

Reveal answer

Strong answer Requirements: zero user impact, a rollback plan for the node phase, and evidence at each gate. Before: the same upgrade runs in staging for a week with the full test suite and synthetic monitoring; scan for removed and deprecated APIs with kubent and the apiserver_requested_deprecated_apis metric; verify every add-on — CNI, CSI drivers, cert-manager, Argo CD, the mesh, the metrics stack — has a version supported on 1.36 and upgrade them first if required; confirm every production PDB currently allows at least one disruption and every Deployment has at least two replicas; snapshot etcd (or confirm the managed backup) and export current manifests; ensure capacity for one extra node per zone; announce a change window and freeze deploys. Control plane: the managed upgrade, during low traffic, with a watch on API server latency and error rate; kubectl clients updated to match. Nodes: a new node pool on 1.36 created alongside the old one, with a canary of one node that receives a sample of workloads by adjusting a spread constraint or by cordoning old nodes one at a time; after an hour of clean metrics, drain the old pool one node per zone at a time, respecting PDBs, waiting for replacements to be Ready and for the SLO dashboards to stay green between nodes; the old pool stays cordoned but present until the end, which is the rollback — uncordon it and drain the new pool. Stateful workloads (any StatefulSet) are handled explicitly: confirm their operator supports the version, drain their nodes last, one ordinal at a time. After: delete the old pool after 24 hours, re-run the deprecation scan for the next version, record the timings, and unfreeze deploys. Trade-offs: the surge pool doubles node cost for a few hours; the deploy freeze annoys teams, so the whole thing is scripted to take under half a day. What I would not do: in-place node upgrades, upgrading the control plane and nodes in one step, or upgrading with a PDB at zero allowed disruptions anywhere.

Land it Rehearse in staging, upgrade add-ons first, replace nodes pool-by-pool with the old pool kept as the rollback, and gate every step on the same dashboards users are measured by.

Likely follow-ups
"Halfway through draining the old pool, error rates rise for one service. What next?"

Stop the drain, which is a single command or pausing the script, so no more nodes move; the old pool is still cordoned but present, so nothing else changes. Then find the service's state: are its Pods on the new nodes Ready and receiving traffic, or is it a service with two replicas that both happened to be evicted in quick succession because its PDB was maxUnavailable: 1 on a two-replica set, which allows a drain to take one, and the second drain took the other while the first was still starting. If the Pods on the new nodes are Ready and slow, it is a new-node property, a kernel or runtime change, and the rollback is uncordoning the old pool and evicting from the new one. If it is a replica-count problem, scale the service up, wait, and resume the drain slower. Either way, the answer exists because the old pool was kept.

"How do you drain one node per zone at a time, and why does zone matter?"

With a script that lists old-pool nodes grouped by the topology.kubernetes.io/zone label and takes one from each group in rotation: cordon, kubectl drain --ignore-daemonsets --delete-emptydir-data --timeout=600s, wait for all evicted Pods' replacements to be Ready and for the SLO dashboards to be quiet, then the next. Zone matters because spread constraints and PDBs are computed against the current placement: draining three nodes in zone A in a row moves every zone-A replica out of A, so a three-replica service with maxSkew: 1 ends up unable to place its third replica, or, with ScheduleAnyway, concentrated in B and C, and a zone failure during the upgrade would then be an outage. Rotating zones keeps the distribution roughly even throughout.

"What would you cut under time pressure if the window is four hours instead of half a day?"

I would cut the hour-long canary to 20 minutes with a stricter pass condition, cut the one-node-per-zone pacing to a percentage-based surge with the drain script running three nodes at once across zones, and skip the 24-hour retention of the old pool in favour of four hours, because the rollback window is the phase where the risk is anyway. I would not cut the staging rehearsal, the deprecation scan, the add-on compatibility check, the PDB audit, or the etcd snapshot, because all of those happen before the window and cost nothing inside it. And I would not cut the explicit handling of StatefulSets. If four hours is not enough even then, the answer is to split control plane and nodes into two windows on different days, which is safe under the skew policy.

"How do you handle a StatefulSet database during the node phase specifically?"

Confirm the operator supports 1.36 and that the cluster has a healthy replica and recent backup. Drain its nodes last, one at a time, and let the operator do the work: CloudNativePG, for instance, performs a switchover to a replica before the primary's Pod is evicted if its Pod is targeted by a drain, so the write interruption is seconds rather than a failover's minute. Check between each ordinal that replication is caught up, pg_stat_replication lag near zero, before the next. For a StatefulSet without an operator, do the switchover manually, then drain. The PDB of one is what makes the drain refuse to take two at once. And watch the application's connection pool during it, with the settings from the pool question in place, because a switchover is a small failover from the application's point of view.

Q133 · Scenario. "After a control-plane upgrade, new nodes join but every Pod scheduled to them fails with 'failed to create pod sandbox: plugin type=\"cilium\" ... connection refused'. Old nodes are fine."

Reveal answer

Strong answer Diagnosis order: sandbox creation is the kubelet calling the CNI plugin to set up networking, and "connection refused" means the plugin binary on the new node cannot reach the Cilium agent's local socket — the agent is not running or not ready on those nodes. Evidence: kubectl get pods -n kube-system -o wide -l k8s-app=cilium shows the agent Pods on the new nodes crash-looping or Pending; their logs give the reason. Ranked causes. One: the Cilium version is incompatible with the new kubelet or kernel — the new node image ships a newer kernel or cgroup configuration the old agent version does not support, or the agent uses an API removed in the new control plane; the agent crashes, the CNI socket never appears, every Pod on the node fails at sandbox creation. Two: the agent is fine but its DaemonSet has a node selector or toleration that does not match the new pool's labels or taints, so it never scheduled there. Three: the new node image lacks a kernel module or has a different container runtime socket path. Four: the agent cannot reach the API server because of a security group difference on the new pool. Fix: upgrade Cilium to a release that supports the new Kubernetes version — which should have happened before the control plane upgrade — or roll the new pool back to the old node image while doing so; cordon the new nodes meanwhile so nothing else lands on them, since existing Pods elsewhere are unaffected. Prevention: the pre-upgrade add-on compatibility check, a canary node in the new pool before scaling it, and an alert on DaemonSet Pods not Ready per node that fires before workloads are scheduled there.

Land it A node without a working CNI agent cannot start any Pod — check the DaemonSet on the new nodes first, and upgrade the network plugin before the cluster, never after.

Likely follow-ups
"The Cilium agent logs say 'failed to attach BPF program' on the new nodes. What does that tell you?"

That the kernel on the new node image and the Cilium version disagree. Cilium compiles and loads eBPF programs against the running kernel, and each release supports a range of kernel versions and requires certain features, such as specific BPF helpers or cgroup v2 mount layout; a newer node image with a newer kernel, or a kernel with a stricter BPF verifier, can reject programs an older Cilium built. The fix is the Cilium version, not the kernel: upgrade Cilium to the release that lists the new kernel in its support matrix, which should have been the pre-upgrade check. As an interim, pin the new node pool to the previous node image so its kernel matches, which lets the pool serve while Cilium is upgraded. What I would not do is try to downgrade the kernel on a managed image or turn off eBPF features by hand.

"Why did existing Pods on old nodes keep working, and what would have broken them?"

Because the data plane is already programmed. Once a Pod's network is set up, packets flow through the kernel's eBPF programs and routes that the agent installed, and the agent only needs to be alive for changes: new Pods, endpoint updates, and policy changes. So old nodes with a healthy agent are fully functional, and even a node whose agent died would keep forwarding existing flows for a while, with Service endpoint updates going stale. What would have broken the old nodes: upgrading the Cilium DaemonSet itself to a version incompatible with their older kernel, a Cilium upgrade that changed the datapath mode and required a node reboot, or the control-plane upgrade removing an API the agent watches, which would make every agent unhealthy at once. That last case is the reason add-on compatibility is checked against the control plane version, not just the node image.

"How would a canary node have caught this, and what does the canary check?"

The new node pool starts with a size of one, cordoned so that only deliberately placed Pods land on it. The check script: wait for the node to be Ready, verify every DaemonSet has a Ready Pod on it, especially the CNI, CSI node driver, kube-proxy if present, and the log and metrics agents; then schedule a test Pod there by uncordoning briefly with a node selector, verify it gets an IP, resolves DNS, reaches a ClusterIP and an external address, mounts a PVC, and exposes metrics that the Prometheus stack scrapes. Only when that passes does the pool scale up. It takes ten minutes, and it catches the sandbox failure here, image pull credential differences, missing kernel modules, and security group gaps, all of which present as "new nodes join fine" until a workload lands.

"What alert would have paged before Pods were scheduled to the broken nodes?"

One on DaemonSet coverage: kube_daemonset_status_desired_number_scheduled - kube_daemonset_status_number_ready > 0 for the CNI DaemonSet for more than two minutes, which fires the moment a node has an agent that is not Ready. Its runbook step is to cordon the affected nodes immediately, which is also what an automation could do. A second, more general one: any node whose Ready condition is true but whose network-unavailable condition or CNI readiness taint is still present, since Cilium sets node.cilium.io/agent-not-ready on nodes until it is ready, and a node that keeps that taint for more than a few minutes is the signal. With that taint in place, the scheduler would not have placed Pods there at all, which is why it exists and why removing it "to make scheduling work" is the wrong fix.

Q134 · Design. "When would you split into multiple clusters, and how would you design a two-region active-active deployment for a stateless service tier with a single-region database?"

Reveal answer

Strong answer Reasons to split clusters, in order of strength: a region — a cluster is inherently single-region; a hard tenancy or compliance boundary (untrusted tenants, PCI scope); a blast-radius limit when one cluster's upgrade or misconfiguration would take down everything; scale limits (thousands of nodes, or API server load from many operators); and environment separation. Reasons not to split: teams, or the wish to give someone admin. For the two-region design: requirements are that a region loss keeps the service available, with degraded write latency acceptable. One production cluster per region, identical, deployed from the same GitOps repository through an ApplicationSet with a cluster generator so the manifests are the same object in both, with per-region values only for endpoints. Global traffic management: a DNS-based or anycast global load balancer (Route 53 latency routing with health checks, or a cloud global load balancer) in front of each region's gateway, with health checks that hit a route which exercises the database connection. The stateless tier in both regions is active; the database is primary in one region with a synchronous or near-synchronous replica in the other. Writes from the secondary region cross to the primary — an extra 20–80 milliseconds, acceptable for a fraction of requests — and reads can be served from the local replica for endpoints that tolerate replica lag, following the read-your-writes discussion in A2 and E8. Failover of the database is a runbook or an operator action that promotes the replica and repoints the cross-region Service; the stateless tiers need nothing but a configuration change delivered through the same GitOps path. Shared services (the secret store, the registry, the identity provider) must themselves be multi-region or the design has a hidden single point. Trade-offs: doubling the cluster count doubles upgrades and drift risk, mitigated by the single source of truth; cross-region writes complicate latency budgets. What I would not do: a stretched cluster across regions (etcd cannot tolerate the latency), or active-active databases without a real multi-master design.

Land it Split clusters by region and by hard boundaries, never by team — and in the two-region design the clusters are identical twins from one repository while the database keeps one primary and an honest failover.

Likely follow-ups
"Requirement change: the database must now accept writes in both regions. What changes and what would you push back on?"

I would push back first, because true multi-master writes mean either accepting conflicts and resolving them, or paying cross-region commit latency on every write. The honest options: partition writes by region, each region owns its own customers' data and the application routes accordingly, which keeps single-writer semantics per partition and needs a routing layer and a plan for customers who move; a globally distributed database built for this, Spanner, CockroachDB, or Aurora Global with write forwarding, with the latency and cost that come with it; or asynchronous replication both ways with conflict resolution rules, which is only acceptable for data where last-writer-wins is tolerable. For the Kubernetes layer nothing changes except that the routing decision, which region serves which customer, moves into the gateway and the application. I would want the product requirement written down before choosing, because each option is a different product.

"How does the global health check avoid failing over on a partial problem?"

The check must measure "can this region serve users" and nothing narrower or broader. Too shallow, a check on the gateway's liveness, keeps sending traffic to a region whose database link is down; too deep, a check that exercises every dependency, fails a region over because one minor service is degraded. So the health route runs a small synthetic transaction: read a row through the local replica and, for the secondary region, confirm the cross-region write path is reachable, with a timeout. The global load balancer uses a failure threshold of several consecutive checks over 30 to 60 seconds to avoid flapping, and failover is per hostname so a partial failure can move some traffic. And there is a manual override: a weight set to zero by an operator during a known regional problem is faster and calmer than waiting for the check.

"What are the hidden single points you said shared services can become? Name them and the fix for each."

The container registry: if it lives in region A and region B's nodes pull from it, a region-A outage stops region B from scaling; the fix is registry replication or a pull-through cache per region. The secret store: Vault in one region means the External Secrets Operator in the other cannot sync; the fix is a replicated store or a per-region replica. The identity provider for workload identity and user login. The CI and GitOps control plane, which is not in the request path but blocks the fix during an incident; per-region Argo CD instances solve it. DNS itself, which must be a global service. Certificate issuance, where cert-manager in each region issues independently. And the monitoring stack, whose global view should live outside either region. Each is found by asking "if region A is gone, what in region B stops working within an hour".

"How do you test that the second region actually works before you need it?"

By making it carry real traffic all the time, which is what active-active means; a region that serves 40 percent of production every day is tested every day. Beyond that, a quarterly drill: set the global load balancer's weight for region A to zero during business hours, watch region B absorb everything with the autoscaler adding nodes, and verify the SLOs hold; then a database failover drill in a scratch environment that promotes the replica and repoints the services. The drill measures the two numbers that matter, time to full capacity in the surviving region and time to database promotion, and each drill's findings become fixes. A design that has never had a region removed on purpose has a recovery time nobody knows.

Drill · Cross-cutting design & judgment

The closing group tests judgment: golden paths, AI workloads, disaster recovery, migrations, and the question every senior must answer — when not to use Kubernetes at all.

Q135 · Design. "Design the 'golden path' for a new Spring Boot service on our platform: what a developer runs, what they get, and what they are not allowed to change."

Reveal answer

Strong answer Requirements: from empty repository to a service in production in under a day, with the platform's baseline applied without the developer reading this appendix. What they run: a template generator (Backstage's scaffolder, or a cookiecutter) that asks for a name, a team, a domain, and dependencies. What they get: a repository with a Spring Boot skeleton whose actuator probes, graceful shutdown, structured JSON logging, OpenTelemetry agent, and Micrometer are pre-configured; a multi-stage Dockerfile with a distroless base, non-root user, and the JVM as PID 1; a CI pipeline that builds, tests, scans, signs, and pushes; a 20-line values.yaml for the platform's library chart; a pull request bot that creates the service's directories in the dev, staging, and production environment repositories; an ExternalSecret stub; an HTTPRoute under the team's hostname; a NetworkPolicy generated from the declared dependencies; a dashboard and SLO alerts generated from the service name; and an ownership label that routes alerts to the team. What is fixed and enforced by admission rather than convention: the security context, the resource pattern (memory request equals limit, no CPU limit), the probe paths, the image registry, the label schema, the PDB, and the spread constraints. What the developer tunes: memory size, replica bounds, dependencies, hostnames, environment-specific configuration, and application code. Escape hatches exist — extra manifests, chart patches — but require a review from the platform team and are tracked so the chart can absorb the common ones. Trade-offs: a golden path is only golden if it is faster than the alternative, so the platform team measures time-to-first-deploy and treats friction as a bug. What I would not do: a wiki page of requirements, or a template that copies the chart into the repository where it will rot.

Land it The golden path is a generator plus a library chart plus admission rules — the developer gets the baseline by default and can only change the parts that are theirs to change.

Likely follow-ups
"A team argues the fixed resource pattern, no CPU limit, breaks their latency-sensitive service. How do you handle it?"

With data and a defined exception path. No CPU limit lets their service borrow idle cycles, which usually helps latency; what hurts it is neighbours with no requests borrowing from them, which is a request problem on the neighbours, not a limit problem on this service. So I would look at CPU pressure on their nodes and at throttling, and usually the fix is to raise their CPU request so the scheduler reserves what they actually need, or to give them a spread rule so they do not share nodes with bursty workloads. If after that they still want a limit, or a dedicated pool, the golden path has an escape hatch: a reviewed override in values with a reason, tracked in a list the platform team revisits. The rule is a default with a documented exit, not a wall.

"How do you measure whether the golden path is working?"

Four numbers. Time from running the generator to the first production deploy, target under a day, measured from the repository creation timestamp to the first production sync in Argo CD. Adoption: the share of services on the current chart version, from a label the chart stamps, target above 90 percent within two minor versions. Exception count: the number of active overrides and raw-manifest escapes, which should shrink as the chart absorbs common needs, and any override used by three or more services is a chart feature request. And the incident correlation: the fraction of production incidents whose cause was a configuration the golden path controls, probes, resources, shutdown, which should approach zero. The platform team reviews those monthly, and friction reported by developers gets treated like a bug with a ticket.

"What would you cut under time pressure to launch the path next month?"

Cut the dashboard and alert generation and give teams a shared template dashboard filtered by service name. Cut the automatic environment-repository pull requests and let the developer copy a directory. Cut the NetworkPolicy generation from dependencies and ship the namespace baseline only. Cut the OpenTelemetry agent injection and add it in month two. Keep: the generator producing a repository with the Spring skeleton configured for probes and graceful shutdown, the Dockerfile, the CI pipeline that builds, scans, signs, and pushes, the values file for the library chart, and the admission rules that enforce the fixed parts. Those give a working service in production that meets the baseline, and everything cut can be layered on without touching the services that already shipped.

"How does a change to the golden path reach the 80 existing services without a big-bang?"

The two halves have different mechanisms. Chart-level changes, probes, resources, spread rules, propagate through chart version bumps as pull requests per service in batches with canaries, as in the packaging design. Repository-level changes, a new Dockerfile base, a CI step, a Spring configuration property, propagate through a template-update tool: the generator keeps a record of which template version each repository came from, and a bot opens pull requests applying the template diff, which Backstage's scaffolder and tools like cruft for cookiecutter support. Teams merge on their schedule, with the same version-window policy as the chart. Truly urgent security changes, a base image with a CVE fix, are pushed by the platform team with the owners informed, because waiting for 80 merges is not an option for those.

Q136 · Scenario. "A service deployed at 5 p.m. Its memory graph rises slowly all night and it is OOMKilled at 3 a.m., every night, then rises again. Heap dumps show nothing unusual. Is it a leak?"

Reveal answer

Strong answer Diagnosis order: a nightly kill with a clean heap says the growth is outside the heap. Evidence: compare three lines over the night — the JVM heap used (flat after warm-up), the container's RSS, and container_memory_working_set_bytes; if the working set climbs while RSS is flat, the growth is page cache charged to the container; if RSS climbs too, it is native memory. Ranked causes. One: page cache from files the container writes or reads — a log file inside the container, a local cache directory, a nightly report written to an emptyDir — grows all night; the kernel should reclaim cache before killing, but with memory request equal to limit and dirty pages from continuous writes, reclaim can lag and the working set counts active cache; the 3 a.m. timing often matches a scheduled task that reads or writes a large file. Two: native memory growth — a direct buffer pool that grows with each nightly batch, glibc arena fragmentation under a threaded workload, a native library leak, or metaspace growth from dynamic class generation (proxies, scripting); native memory tracking shows which. Three: a genuine slow heap leak that the heap dump does not show because the dump was taken after a GC or the retained objects are small and numerous. Fix per cause: move file writes out of the container filesystem (stdout for logs, object storage for reports), sizeLimit on emptyDirs, MaxDirectMemorySize, MALLOC_ARENA_MAX=2, jemalloc for heavy native allocation; and, until fixed, raise the limit rather than restart on a schedule. Prevention: a dashboard that plots heap, RSS, and working set together, so the class of growth is obvious at a glance rather than at 3 a.m.

Land it A leak with a clean heap dump is native memory or page cache — plot heap against working set, and the gap between them names the suspect.

Likely follow-ups
"How do you tell page cache from native memory from the three lines, precisely?"

The three series are jvm_memory_used_bytes summed over heap areas, container_memory_rss, and container_memory_working_set_bytes. RSS is the process's resident anonymous memory plus mapped files it touched; working set is total cgroup usage minus inactive file cache, so it includes active page cache that RSS does not. If heap is flat, RSS is flat, and working set climbs, the growth is file cache the kernel considers active, which means something keeps reading or writing files inside the cgroup. If heap is flat and RSS climbs with working set, the growth is native: direct buffers, metaspace, thread stacks, or malloc arenas, and jcmd <pid> VM.native_memory summary with native memory tracking enabled says which. If heap itself climbs, it is a heap leak after all, and the dump was misleading. One graph with three lines answers the question in a minute.

"Why does the kernel not reclaim the cache before the OOM kill? It is supposed to."

It does try, and with clean cache it succeeds, which is why most services never see this. The trouble is dirty pages: file data written but not yet flushed to disk cannot be dropped until it is written, and a process writing continuously keeps a portion dirty; on a slow or throttled disk, writeback lags. Combined with a container whose limit equals its request and whose heap already occupies most of it, the reclaimable clean cache is small, and when a burst of allocation arrives the cgroup hits its limit before writeback frees enough, and the OOM killer fires. The 3 a.m. timing usually coincides with a scheduled task that both allocates and writes, a report or a log rotation. The working-set metric shows it because the kubelet's eviction and the cgroup limit both count active cache as usage.

"You moved file writes to stdout and set sizeLimit on the emptyDir, and it still dies nightly. What next?"

Then it is native memory, and I enable native memory tracking with -XX:NativeMemoryTracking=summary, take a baseline with jcmd <pid> VM.native_memory baseline at 6 p.m., and a diff at 2 a.m. The categories that grow name the cause: Internal or Other for direct buffers, where -XX:MaxDirectMemorySize caps them and the code that allocates them without releasing gets a review; Class or Metaspace for generated classes, common with scripting engines, reflection-heavy serializers, or a library creating proxies per request, where -XX:MaxMetaspaceSize makes it fail loudly instead of silently; Thread for a thread leak, which a thread dump counts; and a Native or Unknown growth that suggests malloc fragmentation, where MALLOC_ARENA_MAX=2 or switching to jemalloc through LD_PRELOAD is the standard fix. If NMT shows nothing, a native library outside the JVM's tracking is leaking, and that is found by elimination.

"Is restarting on a schedule ever acceptable, and how would you do it if it were?"

As a temporary bridge while the real cause is found, with a ticket and a date, yes; as a permanent fix, no, because it hides a growth that will one day outpace the schedule. If I did it, I would not use a CronJob that deletes Pods, which is a hard kill at a fixed moment. I would raise the memory limit so the kill stops, and set a graceful recycle: a liveness probe is the wrong tool since it kills without draining; the right one is a rolling restart at 2 a.m. via kubectl rollout restart from a CronJob with the right RBAC, so each Pod drains behind the PDB and the readiness gate. The metric that proves the bridge is safe is working set staying below 85 percent of the new limit through the whole night.

Q137 · Design. "Design how the platform runs LLM inference services on the cluster: GPU scheduling, autoscaling, model loading, and isolation from the rest of the workloads."

Reveal answer

Strong answer Requirements: expensive GPUs used efficiently, models that take minutes to load, latency-sensitive serving, and no impact on the CPU services. Design: a GPU node pool with the NVIDIA GPU Operator installing drivers and the device plugin, tainted so only GPU workloads land, scaled from zero by Karpenter with a NodePool allowing several GPU instance types. Serving through vLLM as a Deployment (or a KServe or the Kubernetes Gateway API Inference Extension for model-aware routing) requesting nvidia.com/gpu: 1 — a whole GPU per replica, since time-slicing hurts inference latency — with memory request equal to limit sized for the model's CPU-side footprint, and a startup probe with a budget covering model load (10–20 minutes for a large model). Model loading: weights stored in object storage and cached on a fast local NVMe through a hostPath-backed or local PVC, or pre-baked into the node image for the models that matter, so a new replica loads in a minute rather than pulling 30 GB each time; never bake weights into the container image. Autoscaling on a queue-depth or concurrent-request metric from vLLM through KEDA or the HPA's custom metrics — GPU utilisation lags too much — with a long scale-down window because replicas are expensive to start, and scale-to-zero for internal models with tolerance for a cold start. Isolation: the taint keeps CPU services off the pool and a ResourceQuota on the AI namespace caps GPU count so an experiment cannot consume the budget; a PriorityClass ladder with production inference above experiments, so a research Job is preempted rather than a user-facing model. Dynamic Resource Allocation, stable since 1.34, replaces the device plugin's opaque counter with structured device claims — a Pod can ask for a GPU with at least 80 GB of memory or a specific model — and is what I would adopt as the operator support matures. Observability: DCGM exporter metrics for GPU memory and utilisation on the same dashboards. Trade-offs: whole-GPU allocation wastes capacity for small models, where multi-instance GPU partitioning is the middle ground. What I would not do: share GPU nodes with general workloads, load models from the image, or scale on GPU utilisation. The serving side of this design continues in Module 12.

Land it A tainted GPU pool, one GPU per replica, weights cached on local disk, scaling on queue depth with slow scale-down, and quotas so experiments cannot starve production — the GPU is the budget, and the design guards it.

Likely follow-ups
"Why not scale on GPU utilisation, and what metric from vLLM would you use exactly?"

GPU utilisation from DCGM reports the fraction of time a kernel was executing, and an inference server running a single small batch can show near 100 percent while having plenty of throughput headroom, because it is latency-bound, not throughput-bound; conversely it lags real demand by the whole request duration. What predicts latency is queueing. vLLM exposes vllm:num_requests_waiting, the requests queued and not yet being processed, and vllm:num_requests_running, plus KV-cache usage vllm:gpu_cache_usage_perc. I scale on waiting requests per replica with a target of a small number, say two, through KEDA's Prometheus scaler, with a scale-up stabilisation of zero and a scale-down window of 15 to 30 minutes because a replica takes minutes to load. KV-cache usage above 90 percent is the secondary signal that a replica is saturated even with a short queue.

"Walk me through the model-loading path and the timings, from Pod scheduled to first token."

The Pod is scheduled to a GPU node, which itself may need provisioning, one to three minutes for a GPU instance with drivers. The image pulls, 10 to 15 GB for a CUDA-based serving image, a minute or more unless cached on the node; that is why the image must not carry the weights. The container starts and vLLM begins loading weights: from object storage over the network at a few hundred megabytes per second, a 30 GB model takes two to five minutes; from a local NVMe cache it takes under a minute; and vLLM then compiles CUDA graphs and allocates the KV cache, another minute. The startup probe's budget must cover the worst case, so failureThreshold: 60 with periodSeconds: 10 for ten minutes. Total cold start from Pending to first token is five to ten minutes without the cache and two to three with it, which is why scale-down is slow and a minimum of one replica is kept for anything user-facing.

"How does the GPU quota and priority actually stop a research job taking production down?"

The ResourceQuota on the research namespace includes requests.nvidia.com/gpu: 8, so admission rejects the ninth GPU request there regardless of what the cluster has; the production namespace gets its own quota sized for its ceiling plus headroom. Priority handles contention below the quota: the production inference Deployment carries a PriorityClass with value 100000 and research Jobs 1000, so if the GPU pool is full and a production replica is Pending, the scheduler preempts a research Pod, which is recreated later by its Job. Karpenter's NodePool for GPUs has a limits ceiling so the total spend cannot exceed the budget even under quota. And the research Jobs run with podFailurePolicy ignoring preemption so their retries are not consumed. Without the priority class, the quota alone would let a research Job that got there first hold GPUs while production waits.

"What would you cut under time pressure, and what breaks if you do?"

Cut the local NVMe cache and load from object storage, accepting five-minute scale-ups, which means a higher minimum replica count to cover bursts and more GPU cost. Cut autoscaling entirely for the first month and run a fixed replica count sized for the peak, which is expensive but simple. Cut multi-instance GPU partitioning and give every replica a whole GPU. Cut DRA and use the device plugin. Keep the tainted dedicated pool, because a CPU service landing on a 30-dollar-an-hour node or a GPU Pod on a CPU node are both immediate problems; keep the ResourceQuota on GPUs, because one experiment can consume the month's budget in a day; and keep the startup probe budget, because without it the kubelet kills the replica during model load and it never comes up. Those three take an hour.

Q138. "What is Dynamic Resource Allocation and what limitation of device plugins does it remove?"

Reveal answer

Strong answer A device plugin advertises a device as an opaque, countable extended resource — nvidia.com/gpu: 4 — and the scheduler treats it like CPU: a Pod requests an integer and gets any device of that name. That model cannot express what a GPU workload actually needs: a device with at least 40 GB of memory, a particular model, two devices connected by NVLink, a shareable slice of one device, or a network interface and a GPU on the same PCIe switch. It also cannot allocate part of a device or a device shared between Pods except through vendor-specific time-slicing hacks. Dynamic Resource Allocation, stable since 1.34, introduces a claim model like storage: a DeviceClass defines a kind of device, a driver publishes ResourceSlice objects describing the actual devices on each node with attributes (memory, model, topology), and a Pod references a ResourceClaim or a claim template whose CEL selector says "a device from this class where memory is at least 40 GiB". The scheduler does the matching using the published attributes, so placement is correct rather than lucky, and the driver prepares the device for the Pod when it lands. It also supports claims shared across containers or Pods, and admin-controlled access to devices. The transition: vendors ship DRA drivers alongside their device plugins, and the first thing to change in manifests is the request line, from the extended-resource counter to a claim. For most teams as of 2026 the device plugin still works and DRA is adopted when a workload needs a device attribute that the counter cannot express.

Land it Device plugins count; DRA describes — and once the scheduler can read a GPU's attributes, "any GPU" stops being the only thing you can ask for.

Likely follow-ups
"Show me what the Pod spec looks like with DRA versus the device plugin."

With the device plugin the request is a counter:

resources:
  limits:
    nvidia.com/gpu: 1

With DRA the Pod references a claim, and the claim template carries the selector:

apiVersion: resource.k8s.io/v1
kind: ResourceClaimTemplate
metadata: {name: big-gpu}
spec:
  spec:
    devices:
      requests:
      - name: gpu
        exactly:
          deviceClassName: gpu.nvidia.com
          selectors:
          - cel:
              expression: "device.capacity['gpu.nvidia.com'].memory.compareTo(quantity('80Gi')) >= 0"
---
# in the Pod
spec:
  resourceClaims:
  - name: gpu
    resourceClaimTemplateName: big-gpu
  containers:
  - name: server
    resources:
      claims: [{name: gpu}]

The scheduler evaluates the CEL expression against each node's published ResourceSlices, so the Pod lands on a node with an 80 GiB device rather than any GPU. As of Aug 2026 the resource.k8s.io/v1 API is stable since 1.34, and the exact field shape here follows that version.

"What does the driver do that the device plugin did not, and what happens if it is down?"

A DRA driver has two parts. A controller or the kubelet plugin publishes ResourceSlices describing each device's attributes, so the scheduler sees "device 0, model H100, 80 GiB, NVLink domain 3" instead of a count of four. And a kubelet plugin prepares the device when a Pod is placed: it sets up the device nodes, environment, and any partitioning, and cleans up after. The device plugin only did the second part with a fixed list and no attributes. If the driver's node plugin is down, Pods with claims stay in ContainerCreating on that node, since preparation cannot complete, and if the controller is down, slices go stale, so the scheduler places on outdated information, which the node plugin then rejects at preparation. Existing Pods keep running because their devices are already prepared. So the driver DaemonSet gets the same alerts as the CNI.

"When would you switch a running platform from device plugins to DRA, and how?"

When a workload needs something the counter cannot say: a specific GPU memory size in a mixed pool, a topology requirement for multi-GPU training, or sharing one device between Pods with a defined slice. Until then the counter works and the migration is cost without benefit. The switch itself: install the vendor's DRA driver alongside the device plugin, since the NVIDIA driver supports both modes on the same node as of Aug 2026 as long as a device is advertised through one or the other; create a DeviceClass; move one Deployment to a claim template on a canary pool; verify placement with the node's ResourceSlices and the Pod's allocated claim status; then move the rest and remove the extended resource from the node. Quotas need updating too, because ResourceQuota counts claims by DeviceClass, not by the old resource name.

"Does DRA apply to anything other than GPUs?"

Yes, that is much of the motivation. Network devices, such as SR-IOV virtual functions or RDMA interfaces that must be on the same PCIe switch as the GPU for fast collective operations; FPGAs; confidential-computing enclaves; and in principle any node-attached resource with attributes. The structured parameters model means the scheduler, not a vendor webhook, does the matching, so a Pod can ask for a GPU and a network interface in the same NUMA domain in one claim with two requests and a constraint that they match on a topology attribute. As of Aug 2026 the practical adopters are GPU-heavy inference and training platforms, and the network device drivers are earlier in maturity, so my design would use DRA for GPUs first and watch the network drivers before depending on them.

Q139 · Scenario. "Pods on newly added nodes fail with ImagePullBackOff, 'unauthorized', for images that pull fine on existing nodes. The image and the Pod spec are identical. Find the difference."

Reveal answer

Strong answer Diagnosis order: the same Pod spec pulling on old nodes and failing on new ones means the credential used for the pull differs by node, not by Pod. Evidence: kubectl describe pod shows the pull error with the registry name; a debug session on a new node with crictl pull reproduces it and shows which credential path was tried. Ranked causes. One: the registry is authenticated through the node's cloud identity — an instance role with ECR or Artifact Registry permissions — and the new node pool was created with a different, narrower role, or with none; old nodes still have the old role. Two: the old nodes had a cached image and never actually pulled recently, so the credential broke for everyone but only new nodes notice — check whether the credential (an imagePullSecret or a registry token) expired; an ECR token is valid for 12 hours, and a credential-provider plugin on the kubelet refreshes it, which the new node image may lack. Three: the new nodes are in a subnet without a route to the registry or its VPC endpoint, presenting as unauthorized because the request reaches a different endpoint. Four: a kubelet credential-provider configuration present in the old node image and missing in the new one. Fix: align the node pool's identity and image configuration with the old pool, or move to a Pod-level imagePullSecret managed by an operator that refreshes it, which makes the pull independent of node identity. Prevention: node pool definitions in Terraform with the same modules, a canary node in every new pool, and an alert on ImagePullBackOff by node rather than by Pod.

Land it Pulls succeed with the node's credentials, so a new pool with a different identity fails where the old one cached — check what the kubelet on that node is allowed to be, not what the Pod asks for.

Likely follow-ups
"How does the kubelet get registry credentials from the node's identity, and where does that break?"

Through a kubelet credential provider plugin. The kubelet's --image-credential-provider-config names a plugin binary per registry pattern, for example the ECR provider for *.dkr.ecr.*.amazonaws.com; before a pull, the kubelet runs the plugin, which uses the instance's IAM role to request a short-lived registry token, and the kubelet uses it. It breaks when the new node image lacks the plugin or its configuration, when the instance role lacks ecr:GetAuthorizationToken and the pull permissions, when the registry is in another account without a cross-account policy, or when the node's clock is skewed and the token is rejected. Old nodes hide all of these if they have the image cached, because the kubelet with imagePullPolicy: IfNotPresent never contacts the registry. The check from a node debug session is crictl pull of the image, which shows the real error.

"The fix is in but some Pods still fail on the new nodes. What next?"

The kubelet backs off image pulls exponentially up to five minutes, so a Pod that failed repeatedly waits before retrying even after the credential is fixed; deleting the Pod forces an immediate retry and clears the doubt. If a fresh Pod still fails, the error text matters: "unauthorized" means the credential is still wrong for that registry, and there may be a second registry involved, an init container from a different registry, or a sidecar injected by the mesh from the mesh's registry, which needs its own credential. "Not found" means a tag that exists in one region's registry and not another's, and the new nodes are pointed at a different regional endpoint. "Too many requests" is Docker Hub's rate limit, which old nodes avoided through cache. Each is a different fix, and the debug node's crictl pull with the exact image reference reproduces it.

"Why do you prefer node identity over imagePullSecrets for a private registry, or do you?"

For a cloud registry in the same account, node identity, because there is no secret to rotate or leak; the kubelet obtains a token per pull and nothing is stored in the cluster. For a registry outside the cloud's identity system, such as a self-hosted Harbor or a vendor's private registry, an imagePullSecret is unavoidable, and then I attach it to the ServiceAccount rather than each Pod, generate it with the External Secrets Operator from the store, and rotate it there. The one case where Pod-level secrets beat node identity is a multi-tenant cluster where different teams must not pull each other's images: node identity is shared by every Pod on the node, whereas a per-namespace pull secret is scoped. Most platforms use node identity for the platform registry and per-namespace secrets for team-specific external ones.

"How would you make the node pool difference impossible in the first place?"

By making node pools generated, not hand-made. Every pool comes from the same Terraform module or Karpenter NodeClass with the instance role, the node image, the credential provider configuration, and the security groups as module outputs, so a new pool cannot differ except in the variables the module exposes, size and instance types. The module's tests assert the role's policy attachments. The canary node check from the upgrade design pulls a test image from every registry the platform uses before a pool is allowed to scale. And an alert on ImagePullBackOff grouped by node rather than by Pod, kube_pod_container_status_waiting_reason{reason="ImagePullBackOff"} joined to the node, fires when one node group has the errors and the others do not, which is this exact signature.

Q140 · Design. "Design disaster recovery for the production cluster: what is backed up, how it is restored, and how you prove the recovery time objective."

Reveal answer

Strong answer Requirements: a recovery time objective of, say, one hour for the platform and a recovery point of minutes for persistent data, with a procedure that has been executed, not just written. Design principle: the cluster is rebuildable, not restorable. Everything declarative lives in Git — the cluster's own definition in Terraform, the platform add-ons and every workload in the GitOps repositories — so a new cluster is created and Argo CD repopulates it. What must be backed up because it is not in Git: etcd snapshots (managed services do this; self-managed takes one every 15 minutes) for the case where the same cluster is being repaired rather than replaced; persistent volumes through the CSI driver's snapshots on a schedule, and Velero for coordinated backups of namespaces plus their volumes to object storage in another region; secrets, which live in the external store, itself replicated; and stateful data in managed databases with their own backup and cross-region replication. The restore procedure, in order: Terraform creates the cluster, the bootstrap installs Argo CD pointing at the platform repository, Argo CD installs add-ons then workloads, Velero restores persistent volumes for the few in-cluster stateful services, DNS and the global load balancer are repointed, and the synthetic monitors go green. Proving the RTO: a quarterly drill that builds a fresh cluster in a scratch account from backups and Git alone, with a stopwatch and a checklist; any manual step discovered becomes automation or documentation. Trade-offs: rebuild-first means in-cluster state must be minimal, which pushes stateful services out of the cluster — a feature, and a reason. What I would not do: rely on etcd snapshots as the DR plan (they restore a cluster's objects, not its nodes, load balancers, or disks), or write a plan that has never been run end to end.

Land it Back up the state that is not in Git, rebuild everything that is, and run the rebuild every quarter with a stopwatch — an untested restore is a hope, not a plan.

Likely follow-ups
"Walk me through the first hour of the rebuild, with what can go wrong at each step."

Minute zero: declare the disaster and pick the target account and region, from the runbook. Minutes 0 to 15: Terraform apply for the cluster, VPC, and node pools, from the same state the production cluster came from, or a fresh state if the account is lost; what goes wrong is a cloud quota in the new region, which the drill should have raised in advance. Minutes 15 to 25: the bootstrap script installs Argo CD and points it at the platform repository with a read-only deploy key, which must exist outside the dead cluster; what goes wrong is that key living in the cluster's secret store. Minutes 25 to 45: Argo installs add-ons in sync waves, CNI first, then the secrets operator, then cert-manager, the gateway, and monitoring; what goes wrong is an add-on that needs a cloud resource the Terraform did not create. Minutes 45 to 60: workloads sync, Velero restores volumes, DNS moves. Each step's expected duration is in the runbook from the last drill.

"What is the difference between restoring etcd and rebuilding, and when is each right?"

An etcd restore takes a snapshot of the cluster's object store and loads it into a control plane, so every object comes back as it was at snapshot time, including status fields, secrets, and anything created outside Git. It is right when the control plane itself is damaged but the nodes, disks, and load balancers still exist: a bad upgrade of etcd, a corrupted member, a mass deletion by mistake; then a restore plus a controller restart gets the same cluster back. It is wrong for a real disaster, because the snapshot references nodes that no longer exist, volumes in a region that is gone, and IPs that mean nothing; the controllers would spend hours trying to reconcile ghosts. Rebuilding from Git plus data backups produces a clean cluster that matches the declared state, and objects not in Git, which should be none, are the gap the drill exposes.

"How does Velero coordinate a volume backup, and what does it not guarantee?"

Velero backs up a namespace's objects to object storage and, for volumes, either triggers CSI snapshots through VolumeSnapshot objects or copies the data with its file-system backup agent. A schedule creates backups on a cadence, and a restore recreates the objects and either creates PVCs from the snapshots or copies the data back. What it does not guarantee is application consistency: a snapshot of a database's disk taken while the database is writing is crash-consistent at best, so for a database you use pre- and post-backup hooks that run pg_start_backup style commands, or, better, the database operator's own backup which uses WAL archiving. It also does not back up what is not in the cluster, cloud load balancers, IAM, or DNS. And cross-region restore requires the snapshots to have been copied to the target region, which is a separate cloud setting.

"What would you cut under time pressure, and what is the minimum DR you would sign off?"

The minimum: the cluster fully described in Terraform and every workload in Git so a rebuild is possible; the bootstrap credentials and the GitOps deploy key stored outside the cluster; daily Velero backups of the few in-cluster stateful namespaces to a bucket in another region; the managed databases' cross-region backups confirmed; and one rebuild drill performed end to end, even if it took a day, so the number is known. I would cut the quarterly cadence to twice a year initially, cut CSI snapshots for stateless namespaces entirely, and cut automation of the DNS cutover to a documented manual step. What I would not sign off is a plan without a single completed drill, because every untested DR plan I have seen had a credential or a quota in the wrong place.

Q141 · Scenario. "The API server started returning 429 Too Many Requests to kubectl and to Argo CD, and controllers are lagging. Nothing was deployed. Diagnose."

Reveal answer

Strong answer Diagnosis order: 429 from the API server is API Priority and Fairness shedding load — the API server classifies requests into priority levels with concurrency limits, and when a level's queue is full it rejects with a retry-after. So some client is consuming a level's concurrency, and Argo and kubectl share the level. Evidence: apiserver_flowcontrol_current_inqueue_requests and apiserver_flowcontrol_rejected_requests_total by flow schema and priority level; apiserver_request_total by user agent and verb to find the heavy client; the audit log for the same. Ranked causes. One: an operator or a script doing expensive list calls in a loop — listing all Pods cluster-wide every second without a watch, or with a resourceVersion of zero forcing a full etcd read; a badly written controller that relists on every reconcile; a monitoring integration that scrapes the API on a tight interval. Two: a watch storm — thousands of Pods starting simultaneously (a Job with high parallelism) and every DaemonSet agent re-listing. Three: a client without back-off retrying 429s immediately, which makes the queue worse. Fix: identify the client from the metrics, then throttle it — for a misbehaving operator, scale it to zero or fix its informer usage (watch, do not poll); for legitimate heavy clients, create a dedicated FlowSchema mapping them to their own PriorityLevelConfiguration so they cannot starve kubectl and the GitOps agent; ensure client-go defaults with exponential back-off are in place. Prevention: an alert on flow-control rejections by level, a review rule that controllers use informers with shared caches, and the default fairness configuration left in place — it did exactly what it was meant to do.

Land it 429 is the API server protecting itself from one loud client — find the client in the flow-control metrics and give it its own lane, or fix its polling.

Likely follow-ups
"Explain how API Priority and Fairness classifies a request, with the default levels."

Every request is matched against FlowSchemas in priority order; a FlowSchema matches on the user, group, verb, resource, and namespace, and assigns the request to a PriorityLevelConfiguration and to a flow within it, usually keyed by user. The defaults, from most to least protected: exempt for system masters and health checks, which is never queued; system for nodes and kube-system components; leader-election for controllers' lease renewals, so a busy cluster does not cause leader flapping; workload-high for built-in controllers; workload-low for ServiceAccounts in other namespaces; global-default for everything else, including kubectl users; and catch-all. Each level has a share of the server's concurrency, and within a level, flows are queued fairly, so one user cannot starve others in the same level. A 429 means a level's queues were full, and the flow schema label on the metric tells you which.

"How do you find the offending client in five minutes, exactly?"

Three queries. topk(10, sum by (user_agent, verb, resource) (rate(apiserver_request_total[5m]))), which usually surfaces one user agent listing one resource at an absurd rate. sum by (flow_schema, priority_level) (rate(apiserver_flowcontrol_rejected_requests_total[5m])), which names the level being shed and confirms whether the offender shares it with kubectl and Argo. And apiserver_flowcontrol_request_execution_seconds by level to see whether the requests are numerous or just slow, since a few very slow cluster-wide lists consume concurrency for seconds each. If the user agent is generic, the audit log with a filter on the resource and the last five minutes gives the ServiceAccount and the source IP, and kubectl get pods -A -o wide maps the IP to a Pod. Then scale that Deployment to zero and watch the rejections stop.

"How do you write a FlowSchema that isolates a heavy but legitimate client?"

Create a PriorityLevelConfiguration with its own concurrency share, say nominalConcurrencyShares: 20 and a small queue, and a FlowSchema that matches the client's ServiceAccount and sends it there:

apiVersion: flowcontrol.apiserver.k8s.io/v1
kind: FlowSchema
metadata: {name: backup-operator}
spec:
  priorityLevelConfiguration: {name: backup-level}
  matchingPrecedence: 500
  distinguisherMethod: {type: ByUser}
  rules:
  - subjects:
    - kind: ServiceAccount
      serviceAccount: {name: velero, namespace: velero}
    resourceRules:
    - apiGroups: ["*"]
      resources: ["*"]
      verbs: ["list", "get", "watch"]
      namespaces: ["*"]

Now the client's bursts are shed within its own level and cannot consume the share that kubectl and Argo use. The precedence number must be lower than the default schemas that would otherwise match first. The verification is the flow_schema label on the request metrics changing to backup-operator.

"What in a controller's code causes this, and what is the fix at the source?"

Polling with lists. A controller that, on every reconcile or on a timer, calls client.List for all Pods cluster-wide performs a full read of etcd through the API server each time, serialised, and with a large cluster that is megabytes per call; ten replicas doing it every few seconds is enough. The fix is an informer: a shared cache populated by one list at startup and then a watch that streams changes, so reconciles read from local memory and the API server sees one long-lived watch per resource. In controller-runtime that is the default when using the manager's client, and the bug usually appears when someone constructs a direct clientset for convenience. Two smaller fixes: paginated lists with limit and continue, and resourceVersion="0" on lists, which lets the API server serve from its watch cache instead of etcd. And client-go's rate limiter and back-off must not be disabled.

Q142 · Design. "Design the migration of all workloads from an old cluster to a new one — different CNI, newer version — with no downtime and a rollback."

Reveal answer

Strong answer Requirements: users see nothing, each service moves independently, and any service can move back within minutes. Design: a blue-green cluster migration. Build the new cluster from the same Terraform and GitOps repositories, register it in Argo CD, and have the ApplicationSet deploy every service to both clusters — the manifests do not change, only the target list. Verify the new cluster with the platform's synthetic tests and a full copy of the monitoring. Traffic moves at the edge: the global load balancer or DNS in front of the two clusters' gateways gets the new cluster as a weighted target, and traffic shifts per hostname or per route from 0 to 5 to 50 to 100 percent while the SLO dashboards for that service are watched; a rollback is the weight back to zero. Cross-cluster calls during the split: because a service may run in both clusters at once, internal calls stay within the cluster where they originate — each cluster is complete — so nothing needs a cross-cluster Service; the edge is the only place traffic is split. Stateful pieces: managed databases are shared by both clusters throughout, which is why they live outside; in-cluster StatefulSets (if any survived the earlier arguments) are migrated last, by a data-level replication and a scheduled cutover, or by Velero restore for the few that can tolerate a short freeze. Order: internal tools first, then low-risk services, then the payment path last, over two to four weeks; the old cluster runs for a further week at zero weight as the rollback, then is deleted. Trade-offs: double cost for the window; two clusters' worth of alerts, mitigated by labelling. What I would not do: move workloads by exporting and importing live objects with kubectl (status, IPs, and owner references do not migrate), upgrade the CNI in place on the old cluster (a CNI change is a cluster rebuild in disguise), or migrate the database tier on the same day.

Land it Two complete clusters from one repository, traffic shifted at the edge per service with the weight as the rollback, and data outside both — a cluster migration is just a very large canary.

Likely follow-ups
"How do internal calls behave when a service runs in both clusters at 50 percent weight?"

Each cluster is complete, so a request that enters cluster B through the edge is served entirely inside B: the gateway routes to B's checkout, which calls B's orders through B's ClusterIP, and so on. Nothing crosses. That is the property that makes per-service weights safe, since a service at 5 percent in the new cluster is only receiving 5 percent of the edge traffic for its own hostname, and its downstream dependencies in the new cluster receive that same 5 percent plus whatever their own hostnames get. The subtlety is asynchronous work: a Kafka consumer group with members in both clusters splits partitions across them, which is fine for stateless processing and needs a decision for anything with in-cluster state; and CronJobs run in both unless one side is suspended, which the migration checklist handles by setting suspend: true in the old cluster's overlay as each is moved.

"Why is a CNI change a cluster rebuild in disguise?"

Because the CNI owns every Pod's network namespace, the IP allocation scheme, the node routing, and the policy enforcement, and none of that can be changed under a running Pod. Switching from one plugin to another in place means every Pod must be recreated to get an interface from the new plugin, the old and new plugins would have to coexist with routes for both address schemes during the transition, and NetworkPolicy enforcement would be inconsistent between old and new Pods; a mistake takes down networking for the whole cluster with no rollback except reinstalling the old plugin and recreating everything again. Some vendors document an in-place migration path for specific pairs, and it is still a full Pod churn with a multi-hour window of mixed state. A new cluster with the new CNI, and traffic moved at the edge, has a rollback at every step.

"The payment path is at 50 percent in the new cluster and a subtle error appears. What next?"

Weight to zero for that hostname immediately, which is one change at the edge and takes effect within the DNS or load balancer's propagation time, then investigate with the new cluster still running and receiving synthetic traffic. Likely differences between clusters for a payments path: the egress path to the payment provider, which may be allow-listed by IP at the provider and the new cluster's NAT gateway has a new address; a NetworkPolicy semantics difference under the new CNI, for example how it treats NATed traffic; a secret or certificate that exists in the old cluster but was created by hand and is not in Git; or a version difference in an add-on. The synthetic tests are extended to cover the found gap so the next service does not hit it, and the payment path goes back to 5 percent, not 50, when it returns.

"What would you cut under time pressure if the old cluster's support ends in three weeks?"

Compress the ramp, not the safety. Move internal tools and low-risk services in one batch with weights going 0 to 100 in a day each; move the medium-risk services in a second batch over a week; keep the payment path's own careful ramp but start it in week one rather than last, because it is the one that needs the most time. Cut the week of zero-weight retention on the old cluster to two days. Cut the full monitoring copy in the new cluster to the platform alerts and the gateway SLOs. Do not cut the edge-based weighting, because "cut over everything at once" is the version with no rollback; do not cut the synthetic tests per service, because they are what finds the CNI and egress differences before users do. If three weeks is not enough for that, I would pay the extended support fee for a month, which is cheaper than a payments outage.

Q143. "When would you not use Kubernetes? Give me three real situations and the alternative for each."

Reveal answer

Strong answer Kubernetes is a platform for running many services with a team that can operate a platform; when either half is missing, it is the wrong tool. Situation one: a small team with a few services — three engineers, two web services and a worker. The cluster's care — upgrades three times a year, add-ons, RBAC, networking — consumes a large fraction of that team for a benefit they do not need. The alternative is a managed container service: Cloud Run, App Runner, Azure Container Apps, or Fargate behind a load balancer, which give autoscaling, rollouts, and TLS with a fraction of the surface, and a clean migration path to Kubernetes later if the service count grows. Situation two: a single large stateful system — the primary database, a search cluster, a message broker — where the value of Kubernetes (scheduling many small things) is absent and its risks (node rotation, disk attachment, upgrades) are all present; the alternative is the managed service or dedicated machines with configuration management. Situation three: event-driven, spiky, low-volume work — a few thousand invocations a day that each run for a second; keeping nodes warm for that is waste, and the alternative is functions (Lambda, Cloud Functions) with a queue. I would add a fourth: an organisation that will not fund a platform team; Kubernetes without owners becomes a snowflake cluster that nobody dares upgrade, and a managed container service with less power but no operations is safer. The honest counterweight: once a company has a platform team and dozens of services, Kubernetes's uniformity — one deployment model, one observability model, one security model — pays back everything above, which is why it is the default at scale and the wrong default below it.

Land it Below a platform team and a few dozen services, managed containers or functions; for one big stateful thing, the managed service; Kubernetes is what you choose when uniformity across many services is the problem you actually have.

Likely follow-ups
"Where is the line for the small team? Give me the numbers you would use."

My rule of thumb: below about ten to fifteen services, or below three engineers who would own the platform, a managed container service wins; above about twenty-five services with a dedicated platform owner, Kubernetes wins; in between it depends on the trajectory. The reasoning is operational load. A cluster costs roughly one engineer's time in a small shop, three upgrades a year, add-on updates, security patches, RBAC, and the first few incidents, and that engineer is a large fraction of a five-person team and a rounding error for a fifty-person one. On the other side, each service on a managed container service carries its own configuration for scaling, secrets, and networking, and by a couple of dozen services the lack of a uniform layer starts costing more than the cluster would. A team on the fence should lean toward the managed service and design portably.

"What makes the migration path from Cloud Run to Kubernetes clean, and what breaks it?"

What carries over: the container image built from a Dockerfile, the twelve-factor discipline of configuration through environment and secrets through the platform, health endpoints, stdout logging, stateless processes, and graceful shutdown on SIGTERM; a Spring Boot service built that way moves with a Deployment manifest and no code changes. What breaks it: leaning on the managed service's specific features, request-scoped CPU allocation that lets you skip background threads, its built-in identity headers, its event triggers wired to the platform's own event bus, and its scale-to-zero semantics that some code starts to assume. So I would keep the service's contract with the platform to the container boundary, put anything platform-specific behind an interface, and periodically run the image on a kind cluster in CI to prove it still works without the managed service.

"The team is small but the CTO wants Kubernetes for future scale. What do you say?"

That Kubernetes does not become easier to adopt later, but it also does not become harder, and the cost of running it now is paid every month until the scale arrives. I would offer a concrete compromise: build the services so that the migration is a week of work when the time comes, container images, twelve-factor, health endpoints, infrastructure in Terraform, and start on the managed container service. Set a trigger for the move in numbers the CTO agrees to, such as twenty services or the hiring of a platform engineer. If the CTO still insists, then the least-cost Kubernetes is a managed control plane with autopilot-style node management, GKE Autopilot or EKS Auto Mode, one cluster, a small golden path, and no mesh, no operators, and no custom controllers until there is someone to own them.

"Is a single large stateful system really wrong on Kubernetes, given the operators you described earlier?"

The operators make it possible, and possible is not the same as the best choice. The operator handles failover, backups, and upgrades of the database; what it cannot remove is the cluster's own lifecycle landing on the database: node rotation, kubelet upgrades, CNI changes, and disk attachment behaviour, each of which becomes a database event. When the cluster exists anyway for many services, the database rides along and the operator absorbs most of it. When the database is the only thing that would be on the cluster, the whole cluster's operational burden exists for one workload that a managed service or two well-configured virtual machines would run with less machinery. So the answer is about what else is on the cluster, and for a single system the alternative is nearly always simpler and cheaper.

Q144 · Design. "Design developer environments: how does an engineer test a change to one of 200 services against realistic dependencies, without a full cluster each?"

Reveal answer

Strong answer Requirements: a realistic environment per change, ready in minutes, cheap enough to have hundreds, and disposable. Design in three tiers. Local: a kind or k3d cluster on the laptop with the service's own chart and a slim set of dependencies from a compose-style preset (Postgres, Kafka in KRaft mode, a stub of the payment provider), for the inner loop; Testcontainers for integration tests in CI without any cluster. Ephemeral preview: on every pull request, the pipeline creates a namespace pr-1234 in the shared dev cluster from the tenant template, deploys the changed service's image there with the chart, and points it at the shared dev instances of everything else in a stable dev namespace through configuration — so each preview costs one service's worth of Pods, not 200. Where the change spans several services, the preview namespace holds the changed set and falls back to shared dev for the rest. A route pr-1234.dev.example.com from the gateway, a TTL that deletes the namespace after three days of inactivity, and a quota per preview. For teams that need a whole isolated control plane (operators, CRD work), vCluster gives a virtual cluster on shared nodes in seconds, far cheaper than a real cluster. Staging: one long-lived cluster identical to production in shape, fed by GitOps, for the release candidate. Data: shared dev databases with synthetic data and per-preview schemas where the change touches the schema; never production data. Trade-offs: shared dev dependencies mean one team's broken service affects previews of others, mitigated by the stable dev namespace only receiving versions that passed staging-style checks; and 200 preview namespaces need a quota and the cleanup job or the dev cluster fills. What I would not do: a full cluster per developer, a single shared dev namespace where changes collide, or previews that require the platform team to create anything.

Land it Local for the inner loop, a per-pull-request namespace deploying only what changed against shared dev dependencies, and vCluster for the rare control-plane case — realism per change without a cluster per person.

Likely follow-ups
"How does a preview namespace reach the shared dev instances of everything else, concretely?"

Through configuration, not through DNS tricks. The chart's values for the preview environment set each dependency's address to the shared instance's fully qualified name, orders.dev.svc.cluster.local, and the preview namespace's NetworkPolicy baseline allows egress to the dev namespace. The preview only deploys the changed service, and the platform's preview pipeline generates those values from the dependency list already declared for the egress policy, so the developer sees nothing. For a multi-service change, the pipeline deploys the changed set into the preview namespace and points those at each other by short name, with everything else still going to dev. The limit is that a shared dependency's data is shared, so previews see each other's writes in the shared database; a preview that touches the schema gets its own database schema created by a Job, named after the pull request.

"What does vCluster actually give you, and what does it cost?"

A vCluster is a Kubernetes control plane, an API server and a small datastore, running as a Pod inside a namespace of the host cluster, with a syncer that copies the virtual cluster's Pods into the host namespace to actually run. From inside, a user has a full cluster: their own namespaces, CRDs, RBAC, and admission configuration, so they can install operators and test webhooks without affecting anyone. From the host, it is one namespace with a quota. It starts in under a minute and costs a few hundred megabytes for the control plane plus whatever workloads run. What it does not give: real isolation of the node or the network beyond the host namespace's policies, and host-level features such as a separate CNI or a different Kubernetes version's kubelet behaviour. So it is the right tool for control-plane-level work and the wrong one for testing a node image.

"Requirement change: the security team says shared dev may not hold any production-like data. What changes?"

The data layer of the design changes and the compute layer does not. The shared dev databases are seeded from a synthetic data generator, which produces realistic shapes and volumes with fake identities, rather than from a masked production copy; the generator lives in the platform repository and runs on a schedule so dev data stays fresh and consistent across services. For services whose behaviour depends on real-looking edge cases, the generator gets those cases added deliberately. Staging, which may need something closer to production for performance tests, uses a masked copy produced by a pipeline the security team reviewed, with the masking verified by a test, and it is the only non-production environment allowed to. The rest of the design, previews pointing at shared dev, is unchanged, and it becomes easier to give every developer a database snapshot to reset.

"What would you cut under time pressure to give the first team previews next sprint?"

Cut vCluster, since the first team is unlikely to need a control plane of their own. Cut the multi-service preview and support one changed service per pull request. Cut the per-preview schema and use a shared dev database with a warning. Cut the TTL cleanup job and delete namespaces when the pull request closes, which the pipeline can do with a webhook. Keep the tenant template for the preview namespace, because a preview without a quota and policies is a way to take dev down; keep the gateway route per preview, because a preview nobody can reach is not a preview; and keep the values generation from the dependency list, because that is the piece that makes it zero-effort for the developer. That version is a week of pipeline work.

Q145 · Scenario. "Karpenter is not provisioning nodes for a batch Job; the Pods sit Pending and Karpenter logs 'no instance type satisfied resources'. The Pod asks for 6 CPUs and 48 GiB. Explain."

Reveal answer

Strong answer Diagnosis order: Karpenter tried to design a node for the Pod and found none of the instance types it is allowed to launch would fit. Evidence: the NodePool's requirements (instance families, sizes, capacity type, zones, architecture) and its limits; the Pod's requests, tolerations, affinities, and any topology constraints; the Karpenter log line that names which requirement excluded which candidates. Ranked causes. One: the NodePool's allowed instance list has no type with 48 GiB of allocatable memory — a 64 GiB instance loses several GiB to kube-reserved and the DaemonSets, and the Pod plus the DaemonSets on that node must fit in what remains, so "48 GiB on a 64 GiB node" can fail arithmetic when the pool caps sizes at 64. Two: the NodePool is restricted to a family (compute-optimised, high CPU-to-memory ratio) where no size has that memory at 6 CPUs. Three: the Pod's node affinity or the Job's toleration points at a NodePool with a different taint, so Karpenter evaluates the wrong pool, or the Pool's limits.cpu total has been reached. Four: the requested zone or architecture (an arm64 image with an amd64-only pool) excludes everything. Fix: widen the NodePool's requirements to include memory-optimised families and larger sizes, raise its limits, or correct the Pod's requests — 48 GiB may be a copy-paste — and, in general, keep batch NodePools broad with many families so the cheapest fitting type is always available. Prevention: a check in CI that a Pod's requests fit some allowed instance type after overhead, and an alert on Karpenter's provisioning errors by reason.

Land it Karpenter can only build from the catalogue you gave it — a request that exceeds every allowed type's allocatable, after node overhead, stays Pending with the reason written in the log.

Likely follow-ups
"Do the allocatable arithmetic for a 64 GiB node and tell me whether 48 GiB fits."

Allocatable is capacity minus kube-reserved, system-reserved, and the eviction threshold. On EKS's default formula, a 64 GiB node reserves about 255 MiB plus 11 MiB per Pod up to the max Pods, roughly 1.5 GiB for kube-reserved, and the hard eviction threshold of 100 MiB; GKE reserves more, around 25 percent of the first 4 GiB, 20 percent of the next 4, and so on, which on 64 GiB is about 5.5 GiB. So allocatable is roughly 62 GiB on EKS and 58 GiB on GKE. Then the DaemonSets on every node take their requests, a CNI, a log shipper, a metrics agent, a node-local DNS cache, easily 1 to 2 GiB. That leaves 56 to 60 GiB, and a 48 GiB request fits. It fails on a 48 GiB or a 32 GiB instance, obviously, and it fails on 64 GiB if the NodePool also caps instance size at a family whose 64 GiB sizes have fewer than 6 vCPUs, which is the memory-optimised r-family's 2-vCPU 64 GiB shape.

"How do you read Karpenter's decision from its logs and events?"

Karpenter records the reason on the Pod as an event: kubectl describe pod shows a FailedScheduling from the scheduler and, from Karpenter, an event such as "incompatible with nodepool batch, daemonset overhead={cpu: 500m, memory: 1Gi}, no instance type satisfied resources {cpu: 6, memory: 48Gi} and requirements karpenter.k8s.aws/instance-category In [c], ..." which literally lists the requirement that excluded every candidate. The controller log, kubectl logs -n karpenter deploy/karpenter, has the same with the candidate instance types considered. As of Aug 2026 Karpenter also exposes karpenter_pods_scheduling_decision_seconds and the NodePool's status.conditions for limit exhaustion. The reading skill is to match each requirement in the message to a line in the NodePool and find the one that has no intersection with the Pod's needs.

"The NodePool is widened and the Pod is still Pending. What next?"

Read the new event, because the reason will have changed. Common second causes: the NodePool's limits.cpu or limits.memory total is reached, so no new node may be created regardless of fit, shown as a limit-exceeded condition on the NodePool; the cloud has no capacity for the newly allowed types in the requested zone, which appears as an insufficient-capacity error on the NodeClaim; the Pod has a topology spread or an anti-affinity that no new node can satisfy because the other replicas already occupy every zone; a PVC with a zone affinity that conflicts with the NodePool's allowed zones; or the EC2NodeClass's subnet or security group selectors match nothing in that zone. Each one is visible on the NodeClaim object that Karpenter creates and its status, which is where I look after the Pod's events.

"How would you stop a copy-paste request like this from wasting an afternoon?"

Three cheap checks. A LimitRange maximum per container in the batch namespace, for example 32 GiB, so an oversized request is rejected at admission with a clear message rather than sitting Pending; the team requesting more asks for an exception, and the conversation happens before the run. A CI check in the platform chart's pipeline that computes whether the requests fit some instance type allowed by the target NodePool after a fixed overhead, a small script against a table of instance shapes. And an alert on Pods Pending with an unschedulable condition for more than ten minutes, routed to the owning team with the Karpenter event text in the message, so the person who made the request sees the reason without opening a ticket. The right-sized request also costs less, which is the argument that lands with the team.

Q146 · Design. "Design a Kafka consumer service on Kubernetes that scales with lag and to zero when idle, without losing ordering or duplicating work more than necessary."

Reveal answer

Strong answer Requirements: throughput follows the backlog, cost follows throughput, per-key ordering is preserved, and rebalances are cheap. Design: a Deployment of consumers in one consumer group, with KEDA's Kafka scaler reading the group's lag per partition and scaling replicas between 0 and the number of partitions — more consumers than partitions sit idle, so the partition count is the ceiling and is chosen for the peak (say 24). A lagThreshold of a few thousand messages per replica and a cooldown of five to ten minutes before scaling down, because every replica change triggers a consumer-group rebalance. To make rebalances cheap: the cooperative sticky assignor so only moved partitions pause; terminationGracePeriodSeconds long enough for the consumer to commit offsets and leave the group cleanly on SIGTERM, with a preStop delay not needed here since no inbound traffic exists; a PDB of one so drains do not rebalance everything at once. Ordering is preserved because a partition is owned by one consumer at a time; duplicates are bounded by committing offsets after processing and making processing idempotent on the message key — exactly-once semantics through transactions only if the downstream is Kafka. Scale to zero: KEDA holds replicas at zero when lag is zero for the cooldown, and activates on the first message; the cold start is a JVM boot, so if latency on the first message matters, minReplicaCount: 1. Resources: Guaranteed memory, no CPU limit, a startup probe covering group join. Observability: consumer lag per partition from the Kafka exporter as the primary SLO signal. What I would not do: an HPA on CPU (a consumer waiting on a slow downstream has low CPU and rising lag), more replicas than partitions, or scaling on a five-second cooldown that rebalances the group into a stall.

Land it Scale on lag with KEDA up to the partition count, make rebalances cooperative and shutdowns clean, and let idempotency absorb the duplicates that any rebalance will create.

Likely follow-ups
"Write the KEDA ScaledObject and explain the numbers."

The object that drives the Deployment:

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata: {name: orders-consumer}
spec:
  scaleTargetRef: {name: orders-consumer}
  minReplicaCount: 0
  maxReplicaCount: 24
  pollingInterval: 15
  cooldownPeriod: 600
  advanced:
    horizontalPodAutoscalerConfig:
      behavior:
        scaleDown: {stabilizationWindowSeconds: 300, policies: [{type: Pods, value: 2, periodSeconds: 120}]}
  triggers:
  - type: kafka
    metadata:
      bootstrapServers: kafka-bootstrap.messaging:9092
      consumerGroup: orders-consumer
      topic: orders
      lagThreshold: "2000"
      activationLagThreshold: "10"
      allowIdleConsumers: "false"

maxReplicaCount equals the partition count because extra consumers idle. lagThreshold means one replica per 2,000 messages of lag, so lag of 20,000 asks for ten replicas. activationLagThreshold is the lag that wakes the deployment from zero. cooldownPeriod waits ten minutes of zero activity before scaling to zero, and the scale-down policy removes at most two replicas every two minutes so rebalances are spaced out.

"Why does every replica change cost you, and what does the cooperative sticky assignor change?"

A consumer joining or leaving a group triggers a rebalance, and with the default eager protocol every member revokes all its partitions, the group leader computes a new assignment, and every member resumes; during that window, typically seconds and sometimes tens of seconds with slow members, nothing is consumed, and in-flight batches must be reprocessed after the resume, which is where duplicates come from. The cooperative sticky assignor, partition.assignment.strategy=org.apache.kafka.clients.consumer.CooperativeStickyAssignor, does it incrementally: members keep the partitions they already own, only the partitions that must move are revoked, and consumption on the others continues. So scaling from 8 to 10 replicas pauses only the few partitions moving to the new members. It needs every member of the group on the cooperative protocol at once, so rolling it out on a live group needs the two-step upgrade documented by Kafka.

"How do you bound duplicates, and how do you actually get exactly-once?"

Duplicates come from the gap between processing a message and committing its offset: if the consumer dies in the gap, the next owner reprocesses from the last commit. Bound it by committing often, after each batch rather than on a long timer, by making the batch small, and by handling SIGTERM to commit before leaving the group; then a crash replays at most one batch. Then make processing idempotent so the replay is harmless: an upsert keyed on the message key, or a processed-message table with the topic-partition-offset as a unique key checked in the same transaction as the write. That combination is effectively exactly-once for a database sink. True exactly-once, where the producer's writes and offset commits are atomic, exists only when the sink is Kafka, through transactional producers and isolation.level=read_committed consumers; the sink being a database means the transaction boundary has to be built in the database.

"Requirement change: some messages take minutes to process. What breaks and what do you change?"

Two things break. Kafka's max.poll.interval.ms, five minutes by default, is the longest a consumer may go between polls before the broker considers it dead and rebalances the group, so a message that takes six minutes causes a rebalance storm; raise it, or process asynchronously while continuing to poll and pausing the partition with pause() until the work completes. And the scaling signal becomes misleading, since a small lag of slow messages is a lot of work; lag per replica still works but lagThreshold must be set from processing time, and the maximum useful replicas is still the partition count, so the topic may need more partitions, which is a one-way change. The termination grace period must cover the longest in-flight message plus the commit, so it becomes minutes, and the PDB and the drain budget must accept that a node drain takes that long.

Q147 · Scenario. "A cloud zone failed. A three-replica service spread across zones went to two replicas as expected — but a second service with five replicas went completely down. Both had spread constraints. Explain the difference."

Reveal answer

Strong answer Diagnosis order: a spread constraint distributes Pods, so five replicas across three zones should have left three or four running; total loss means the Pods were not actually spread, or something they depended on was zonal. Evidence: kubectl get pods -o wide from before the failure (or the exported events) shows where the five Pods lived; the Deployment's spread constraint fields; the PVCs and Services the second service uses. Ranked causes. One: the constraint was whenUnsatisfiable: ScheduleAnyway and at some earlier point — a scale-up during an incident, a node pool that briefly existed only in one zone — the scheduler placed all five in one zone because that was the best it could do; nothing ever rebalanced them afterwards, since the scheduler only decides at placement and the descheduler was not running. Two: the constraint used maxSkew: 1 across kubernetes.io/hostname, not zone, so the Pods were on five nodes that all sat in one zone. Three: the Pods were spread but shared a zonal dependency — a ReadWriteOnce disk, a zonal in-cluster cache, or a NodeLocal component — in the failed zone, so they were Running but not Ready. Four: the service's gateway route or its Service used internalTrafficPolicy: Local and the callers were in the failed zone. Fix now: scale the Deployment up to force new placements in the surviving zones, and check the dependency. Prevention: DoNotSchedule on the zone constraint for anything critical, with minDomains: 3 so the scheduler refuses rather than concentrates; the descheduler's RemovePodsViolatingTopologySpreadConstraint strategy running continuously; a chaos drill that cordons a whole zone; and a policy that any zonal dependency is listed in the service's design.

Land it A spread constraint is a placement rule, not a guarantee over time — with ScheduleAnyway and no descheduler, a bad day months ago can leave all five Pods in the zone that just died.

Likely follow-ups
"Write the spread constraint you would put on every critical Deployment and explain each field."

On the Pod template:

topologySpreadConstraints:
- maxSkew: 1
  topologyKey: topology.kubernetes.io/zone
  whenUnsatisfiable: DoNotSchedule
  minDomains: 3
  labelSelector: {matchLabels: {app: checkout}}
  matchLabelKeys: [pod-template-hash]
- maxSkew: 1
  topologyKey: kubernetes.io/hostname
  whenUnsatisfiable: ScheduleAnyway
  labelSelector: {matchLabels: {app: checkout}}

maxSkew: 1 means no zone may have more than one Pod more than any other. DoNotSchedule makes the scheduler leave a Pod Pending rather than violate it, which is what triggers the autoscaler to add a node in the thin zone. minDomains: 3 tells the scheduler to count three zones even if a zone currently has no nodes, so it cannot satisfy the skew by pretending only two zones exist. matchLabelKeys with the template hash makes the constraint apply per ReplicaSet, so a rollout's new and old Pods are counted separately and the rollout does not deadlock. The hostname constraint is soft because insisting on distinct nodes is often impossible on a small cluster.

"Why does the scheduler never fix a bad spread, and how does the descheduler do it safely?"

The scheduler acts once per Pod, at placement, and never revisits a running Pod; Kubernetes has no built-in rebalancing because moving a Pod means killing it, and the scheduler is not in the business of deciding that. So the five replicas that were placed in one zone during the incident stayed there for months. The descheduler is a separate component that runs on an interval, evaluates strategies, and evicts Pods that violate them through the eviction API, which respects PDBs; the replacement Pod is then placed by the scheduler under the current constraints. The RemovePodsViolatingTopologySpreadConstraint strategy finds Pods whose spread exceeds the skew and evicts the surplus ones in the crowded domain, a few at a time by its own limits, so a PDB of one means it moves one replica at a time. It is safe precisely because it uses eviction and never bypasses budgets.

"How does a zone loss look from the scheduler's point of view, and what happens to DoNotSchedule Pods?"

When zone C's nodes go NotReady, their Pods are evicted after the tolerance period and their Deployments create replacements. With DoNotSchedule and minDomains: 3, the scheduler wants to place replacements in the zone with the fewest Pods, which is C, and C has no schedulable nodes, so the replacements stay Pending; the surviving replicas in A and B keep serving. That is the intended trade: two of three replicas up, capacity reduced by a third, and the Pending Pods are the signal for the autoscaler to add nodes in C when it returns. If the service must regain full replica count during the outage, the constraint's skew needs to allow it, and the way to express that is a larger maxSkew or the nodeAffinityPolicy and nodeTaintsPolicy fields that make the scheduler ignore unschedulable zones when computing skew. I would rather have three-replica services accept two during a zone loss than risk placing all three in one zone.

"What would have caught the bad placement of the five-replica service months earlier?"

A recording rule on kube-state-metrics: count of Pods per Deployment per zone, from kube_pod_info joined to kube_node_labels on the node's zone label, and an alert when any Deployment with three or more replicas has all of them in one zone, or when the max minus min across zones exceeds one for an hour. The same query as a dashboard panel makes the drift visible to the owning team. Plus a quarterly zone drill: cordon and drain one zone's nodes in staging with the same manifests, and see which services go to zero. The drill would have found both the constraint mistake and the zonal disk dependency in one afternoon, which is why it is on the list of things I run before I need them.

Q148 · Design. "Design a single-region production cluster so that the loss of any one availability zone is invisible to users."

Reveal answer

Strong answer Requirements: capacity, placement, dependencies, and the control plane all survive one of three zones vanishing. Capacity: every node pool spans all three zones, and the fleet runs at no more than two-thirds of what it would need if one zone were gone — concretely, at 60 percent requested overall so the remaining two zones can absorb the third's Pods; the autoscaler's per-zone groups (or Karpenter with zone requirements) can add nodes in the survivors within minutes, but the first minutes are covered by headroom and by the over-provisioning placeholder Deployment. Placement: the platform chart puts a zone spread constraint with DoNotSchedule, maxSkew: 1, and minDomains: 3 on every Deployment, and the descheduler corrects drift; minimum replicas of three for anything user-facing, so a zone loss leaves two; PDBs of one so rebalancing after the failure cannot cascade. Dependencies: CoreDNS, the gateway proxies, and the metrics stack run with replicas across zones on the system pool; in-cluster stateful services keep a replica per zone with data replication (a Postgres operator with a synchronous replica in another zone, Kafka rack-aware); managed databases are multi-zone; persistent disks for anything single-instance are accepted as a zone risk and listed. Traffic: the cloud load balancer spans zones with cross-zone load balancing enabled, so it does not need a healthy backend in every zone; topology-aware routing is off for critical services so a zone with fewer replicas does not get starved or overloaded. Control plane: the managed control plane is regional; for self-managed, etcd members across three zones. Proof: a quarterly exercise that cordons and drains one zone's nodes during business hours with the SLO dashboards watched. Trade-offs: a third more capacity than a zone-blind design and stricter scheduling that occasionally leaves a Pod Pending until a zone has room — which is the point. What I would not do: spread constraints with ScheduleAnyway for critical services, two replicas (a zone loss leaves one), or a zonal StorageClass without the failure listed in the design.

Land it Headroom for the missing third, hard spread with three domains, dependencies replicated per zone, and a drill that proves it — zone resilience is capacity arithmetic enforced by the scheduler.

Likely follow-ups
"Explain the 60 percent number and what happens to cost if I want 99.9 percent instead of zone-loss tolerance."

With three zones and one lost, two-thirds of the nodes remain, so the surviving capacity must hold everything: requested resources divided by two-thirds of total allocatable must stay under 100 percent, which means running the full fleet at no more than 66 percent requested, and I round down to 60 for headroom during the minutes before the autoscaler adds nodes in the survivors. That is roughly a third more capacity than a zone-blind design, and it is the cost of the requirement. If the target is stated as 99.9 percent availability rather than "a zone loss is invisible", the arithmetic changes: a zone loss is rare, a few hours a year at most, and 99.9 percent allows about nine hours of downtime a year, so the design could run at 80 percent and accept degraded performance during a zone loss, with the autoscaler restoring capacity within ten minutes. The numbers should follow from the stated objective, and I would make the business choose it explicitly.

"How does the cloud load balancer behave during a zone loss, and what setting matters?"

A regional load balancer has a node in each zone, and by default on AWS a network load balancer sends traffic arriving at zone A's node only to targets in zone A. If zone A's targets are gone, that zone's load balancer node fails its health checks and DNS stops returning it, but DNS caching means some clients keep hitting it for the TTL, 60 seconds, and see failures. With cross-zone load balancing enabled, every load balancer node forwards to healthy targets in any zone, so a client that reaches zone A's node still gets served by B and C; the cost is cross-zone data transfer charges on the traffic. For an application load balancer it is on by default; for a network load balancer it must be enabled, and the AWS Load Balancer Controller sets it through an annotation on the Service. That one setting is the difference between a zone loss being invisible and being a minute of errors.

"What are the zonal dependencies people forget, and how do you find them?"

Persistent disks are the obvious one; the less obvious: a NAT gateway per zone, where a zone loss removes egress for the surviving nodes if they route through it, which the VPC design must avoid by giving each zone its own; a single-zone cache or a Redis without replicas; a zonal in-cluster component such as a single-replica Prometheus, the External Secrets Operator, or the gateway controller whose loss stops healing even though traffic still flows; a CoreDNS with two replicas that happened to land in the same zone; and the cluster autoscaler's own node group configuration where the surviving zones' groups have a maximum too small to absorb the third. Finding them is the drill: cordon and drain a zone in staging with production manifests, watch what stops, and record each finding as a design entry with an owner. Reasoning about it finds half; the drill finds the rest.

"What would you cut under time pressure, and what could you never cut?"

Cut the descheduler and accept that placement drifts until the next rollout. Cut the over-provisioning placeholder and accept that the first minutes after a zone loss are degraded until the autoscaler catches up. Cut the quarterly drill to an annual one at first. Never cut: node pools spanning three zones, because a two-zone pool cannot satisfy minDomains: 3 and the whole design collapses; the spread constraint with DoNotSchedule in the platform chart, because it is what stops the five-replicas-in-one-zone story; minimum three replicas for user-facing services; cross-zone load balancing; and CoreDNS and the gateway spread across zones, since every service depends on them. Those cost a chart change and a capacity setting and are the whole point.

Q149. "Kubernetes versus a managed container service like Cloud Run or Fargate — what does each layer give up, and how would you explain the choice to a CTO?"

Reveal answer

Strong answer A managed container service takes an image and runs it behind an address with autoscaling, rollouts, and TLS; you never see a node, a scheduler, or a manifest beyond a few settings. What you give up: the object model — no sidecars in the same sense, no DaemonSets, no NetworkPolicies, no operators or CRDs, limited control over placement and shutdown, and the vendor's shape for networking and identity, so anything that needs the cluster's flexibility (a mesh, GPU scheduling with custom drivers, complex batch, third-party operators) is out. What you gain: no cluster to upgrade, patch, or secure at the node level, per-second billing that scales to zero, and a much smaller set of things to know. Kubernetes gives up simplicity and takes on a platform team, in exchange for uniformity across hundreds of services, an ecosystem that ships as Helm charts, and portability across clouds that is real for the workload layer even if the platform layer is rebuilt per cloud. Fargate is the middle: Kubernetes objects without nodes, at a higher per-Pod price and with restrictions (no DaemonSets, no privileged containers). To a CTO: "The question is whether we are buying a platform or a service. Below about twenty services and without a platform team, the managed service costs less in total and gets us to market faster; above that, the uniformity of Kubernetes is what keeps two hundred services operable by a small team, and the platform team is the price of that uniformity. We can start on the managed service and move to Kubernetes when we have the service count and the team — the container images and the twelve-factor discipline carry over unchanged."

Land it Managed containers sell simplicity per service; Kubernetes sells uniformity across many — the honest advice names the service count and the team size at which the second becomes cheaper than the first.

Likely follow-ups
"Put numbers on it: what does the platform team cost, and where does the managed service's per-request price cross it?"

A minimal platform team for a production Kubernetes estate is two to three engineers, which fully loaded is somewhere between 400,000 and 700,000 dollars a year in most markets, plus the control plane and system pool overhead, perhaps 30,000 to 60,000 a year. A managed container service charges per vCPU-second and GiB-second with a premium over raw instances, roughly 1.5 to 3 times the equivalent node cost at steady load, less when workloads are idle since it scales to zero. So the crossover is where the compute premium exceeds the team: if the workloads would need 200,000 dollars of nodes a year on Kubernetes, the managed service premium is 100,000 to 400,000, which is below or near the team cost, and the managed service wins; at two million of compute, the premium dwarfs the team, and Kubernetes wins. Those are estimates to be replaced with the organisation's own numbers, but the shape of the curve is the argument.

"What does Fargate or an autopilot-style mode actually restrict, and is it a good middle?"

Fargate runs each Pod on its own micro-VM, so there are no nodes to manage, but that means no DaemonSets, so logging and monitoring agents become sidecars; no privileged containers or host access; no GPUs on Fargate; Pod sizes from a fixed menu; slower starts of a minute or so; and a higher per-Pod price. GKE Autopilot and EKS Auto Mode are different: they still give you nodes and DaemonSets, but the provider manages the node pools, upgrades, and scaling with opinionated defaults and a per-Pod or per-node premium. For a team that wants the Kubernetes object model without node operations, autopilot-style modes are a good middle as of Aug 2026, and I would pick them over Fargate for most estates. Fargate fits a few isolated workloads that need strong per-Pod isolation and where DaemonSet loss does not matter.

"The CTO asks whether portability across clouds is real. Answer honestly."

At the workload layer, yes: a Deployment, Service, HTTPRoute, and ConfigMap move between EKS, GKE, and AKS with small changes, and the images are identical. At the platform layer, no: the CNI, the load balancer controller, workload identity, storage classes, the registry, the secrets integration, and the autoscaler are all cloud-specific, and a move is a rebuild of that layer, typically weeks to months for a mature platform. So the honest statement is that Kubernetes makes the applications portable and the platform team's skills portable, and it does not make the platform portable. That is still worth something: it means a cloud negotiation has a credible alternative, and it means hiring from a common skill pool. What it is not is a free migration, and I would not sell it as one.

"You said start managed and move later. What do you set up on day one so that the move is cheap?"

Five habits. Every service is a container built from a Dockerfile in its repository, with health endpoints and graceful shutdown, tested by running the image locally. Configuration comes from environment variables and mounted files only, never from the managed service's API at runtime. Secrets live in the cloud secret store, which both platforms can read. Infrastructure is in Terraform from the first day, including the managed service's definitions, so the shape is documented and diffable. And observability goes through OpenTelemetry rather than the managed service's proprietary agent, so the dashboards and traces survive the move. With those, a service moves to a Kubernetes Deployment with a values file, and the migration is the platform build, not 20 application rewrites. That is the sentence I would put in the decision record.

Q150. "Last one. A new senior hire asks you for the mental model that lets them reason about any Kubernetes incident. Give it to them in the order you would actually walk it."

Reveal answer

Strong answer Two ideas and one procedure. Idea one: everything is a loop comparing desired state in etcd with observed state, and every incident is one loop that stopped making progress — so the question is never "what is broken" but "which loop is stuck, and what is it waiting for". Idea two: serving traffic does not need the control plane, so control-plane incidents delay healing while data-plane incidents hurt users; deciding which kind you are in comes first. The procedure walks the loops in the order a Pod passes through them. Is the object there as intended? — kubectl get with the GitOps status, because a drift or a failed sync is not a runtime problem at all. Is it scheduled? — Pending means the scheduler's filters said no; the Pod's event names the filter. Is it created? — ContainerCreating means the kubelet is stuck on image, volume, or network; the events name which. Is it running? — CrashLoopBackOff means read the exit code and the previous log; configuration, memory, or a probe budget. Is it Ready? — Running but not Ready means the readiness probe or a dependency; nothing is routed to it. Is it reachable? — endpoints, DNS, policy, then the connection-level behaviour of Services. Is it healthy under load? — throttling, working set, pool metrics, and the HPA's view. Is the node healthy? — conditions, pressure, the DaemonSets that give the node its networking and logging. Is the cluster healthy? — API latency, etcd, capacity headroom, autoscaler status. At each step, the evidence is a specific command — describe, logs --previous, get events, top, debug — and the mitigation that is always safe is to move traffic away from the sick thing (drain, scale, weight to zero) before understanding it. Then write down which loop it was, so the next person starts one step further along.

Land it Find the loop that stopped, read what it is waiting for, move users away from it, then fix it — every question on this page is a special case of that sentence.

Likely follow-ups
"Give me the one command for each step of the walk."

Is it there as intended: argocd app get orders or kubectl get deploy orders -o yaml compared with Git. Is it scheduled: kubectl get pod -o wide for the node column, and kubectl describe pod for the FailedScheduling event that names the filter. Is it created: the same describe, reading the events for FailedMount, ErrImagePull, or a sandbox error. Is it running: kubectl logs orders-abc --previous and the lastState.terminated.exitCode from kubectl get pod -o jsonpath. Is it Ready: the readiness condition message in describe and kubectl get endpointslices -l kubernetes.io/service-name=orders. Is it reachable: kubectl debug with a network image, then resolve, then connect to the Service, then to a Pod IP. Is it healthy under load: kubectl top pod and the throttling and working-set queries. Is the node healthy: kubectl describe node for conditions and kubectl get pods -A -o wide --field-selector spec.nodeName=X. Is the cluster healthy: API latency, etcd fsync, and the autoscaler status.

"How do you tell a control-plane incident from a data-plane incident in the first minute?"

Ask whether users are affected and whether healing is affected, separately. If the gateway's error rate is normal but kubectl is slow, Argo is lagging, and new Pods are not being created, the control plane is sick and the data plane is fine: traffic flows through kernel rules that are already programmed and containers that are already running, and the danger is that the next failure will not heal. If users see errors and the API is responsive, the data plane is sick, and the control plane is the tool you fix it with. If both, the control plane comes first, because nothing else can be repaired without it. The minute-one checks: the gateway SLO panel for users, and kubectl get --raw /readyz?verbose plus the API latency panel for the control plane.

"What is the mitigation that is always safe, and when is it not?"

Moving traffic away from the sick thing: cordon and drain a bad node, scale a Deployment to add healthy replicas, weight a canary or a cluster to zero at the edge, or roll back a Deployment to its previous ReplicaSet. Those actions reduce exposure without needing to understand the cause, and they are reversible. They are not safe in three cases. When the sick thing is a stateful quorum member, where draining can lose quorum, so you fence and wait rather than move. When the cluster has no spare capacity, where draining a node turns one node's problem into a cascade, so you add capacity first. And when the sick thing is a shared dependency such as CoreDNS or the CNI, where "moving traffic away" has no meaning and the fix is to repair it in place with the fastest known-good version. Knowing those three exceptions is the difference between a safe first move and a second incident.

"How would you teach this to the new hire in practice rather than as a lecture?"

With a broken cluster. I keep a kind or a scratch namespace with a set of pre-built failures: a Deployment with a wrong selector, a Pod with a request larger than any node, an image tag that does not exist, a readiness probe on the wrong port, a NetworkPolicy that blocks DNS, a Service with a mismatched targetPort, a CPU limit that throttles, and a StatefulSet with a stuck ordinal. The new hire works through them with the walk and writes one line per failure: which loop, which command found it, what the fix was. Then they shadow two real incidents and lead the third with someone beside them. Finally they add a failure of their own to the set from something they saw. The mental model is the walk; the skill is having done it enough times that the first command is reflex.

11 · RecapWhat You Can Do Now

  • You can narrate kubectl apply from the keystroke to a routed request, naming the component at every step and what "created" does not mean
  • You can explain requests versus limits at the kernel level — CFS throttling, working-set memory, the OOM killer, QoS classes — and size a JVM container so the heap and the cgroup agree
  • You can say which probe may check a dependency and which must not, and predict the restart storm a wrong liveness probe causes
  • You can do the rollout arithmetic, draw the termination timeline, and explain why a preStop sleep is the difference between zero and two percent errors on deploy
  • You can follow a packet from a client Pod to a backend — CNI, EndpointSlice, kube-proxy or eBPF, DNS — and diagnose "resolves but times out" in four commands
  • You can draw a security boundary with the tools that enforce one — Pod Security Standards, NetworkPolicy, RBAC, workload identity, admission policy — and say what a compromised Pod can still reach
  • You can walk a Pending, ContainerCreating, CrashLoopBackOff, NotReady, or 429 incident in diagnosis order, and stabilise a node-loss cascade before understanding it
  • You can design a cluster layout, a tenancy model, a zero-downtime deploy, an autoscaling strategy for bursts, and disaster recovery — and argue for the managed service when it is the better answer
🧠 Flex your memory

Close the page and write down, from memory: the eight steps from kubectl apply to a Pod receiving traffic, with the component that performs each one; and the two parallel paths that start when a Pod is deleted, with the field that bridges them. Then reach back to Chapter E8's connection-pool section: a database Pod moves to another node — which three HikariCP settings decide whether the application recovers in seconds or in fifteen minutes, and why does a Kubernetes Service not save you from needing them?