Kubernetes Interview Questions
Pods, Deployments, Services, networking, storage, scaling, scheduling, security & production operations.
← Learn this topic from scratch firstKubernetes Architecture: Control Plane & Worker Nodes
Why does Kubernetes recommend an odd number of control plane nodes?
beginneretcd uses Raft consensus requiring a strict majority quorum. 3 nodes tolerate 1 failure (quorum=2), 5 nodes tolerate 2 failures (quorum=3). 4 nodes also only tolerate 1 failure same as 3 -- the odd-count step-up is meaningful.
What happens to running Pods if the entire control plane becomes unavailable?
beginnerAlready-running Pods continue running -- kubelets are autonomous. What stops: new scheduling, failure recovery, kubectl commands, rolling updates, and HPA decisions.
What is the controller pattern?
beginnerA continuous control loop that watches the API Server for objects, compares desired state to actual state, and takes actions to close any gap. This runs indefinitely, making Kubernetes self-healing.
All control plane nodes in the same AZ which suffers a network partition
beginneretcd loses quorum; the control plane stops making decisions. Existing Pods continue running (kubelets are autonomous) but nothing new can be scheduled, crashed Pods cannot be replaced, and kubectl commands fail. Prevention: distribute control plane nodes across at least 3 AZs.
kubectl get pods hangs 30s even though the application serves traffic normally
beginnerThe API Server is down or network-partitioned from the client. The application continues normally because kubelets and the container runtime are autonomous. kubectl always requires a reachable API Server.
Core Components: API Server, etcd, Scheduler, Controller Manager, Kubelet & Kube-Proxy
What is the Scheduler's filter and score phase?
beginnerFiltering eliminates nodes that cannot run the Pod (insufficient resources, untolerated taints, failed affinity). Scoring ranks remaining feasible nodes. The highest-scoring node is selected and a Binding is written. The Scheduler never starts containers.
What is CRI and why was it introduced?
beginnerContainer Runtime Interface -- a standardized gRPC API decoupling kubelet from any specific runtime. Lets Kubernetes support containerd, CRI-O without runtime-specific kubelet code. Enabled dockershim removal.
What are the three kube-proxy modes?
beginneriptables (legacy, sequential rules, cost grows linearly), IPVS (hash-table kernel load balancer, scales better), eBPF (lowest per-packet overhead, used by CNIs like Cilium).
Pod stuck in Pending with no scheduling events visible
beginnerComplete absence of scheduling events means the Scheduler is not seeing the Pod -- check whether the Scheduler is healthy. A FailedScheduling event with a reason means the Scheduler works but no node satisfies constraints. Different root causes requiring different diagnoses.
New failurePolicy: Fail webhook breaks all Pod creation cluster-wide
beginnerWith failurePolicy: Fail, an unreachable webhook causes rejection of every matching creation. Fix: ensure the webhook has HA and readiness gating before registration. Treat admission webhooks with the same operational rigor as control plane components.
Pods: Lifecycle, Init Containers & Sidecars
What is the execution-order guarantee for init containers?
beginnerProInit containers run strictly sequentially in listed order; each must exit with code 0 before the next starts. All must complete before any app container or native sidecar starts.
What problem does the native sidecar feature solve?
beginnerProIn the older pattern, a sidecar was just a regular container with no ordering guarantees -- it could terminate before the app. The native sidecar (restartPolicy: Always on an init container) guarantees it starts before app containers and is signaled only after them.
What is the difference between Pod phase and Pod conditions?
beginnerProPhase (Pending, Running, Succeeded, Failed, Unknown) is coarse. Conditions (PodScheduled, Initialized, ContainersReady, Ready) are granular booleans. Automation should check the Ready condition -- a Pod can be phase Running while Ready is still False.
Pod in Running phase but 0/1 Ready with connection-refused errors
beginnerProPhase Running only means the container process started. 0/1 Ready means the readiness probe is failing. Check the readiness probe configuration and startup logs.
Init container keeps Pod in Init status for 10 minutes despite dependency being healthy
beginnerProCheck DNS resolution or network policies affecting newly scheduled Pods differently. Also verify the init container retry logic is not overly conservative with long fixed sleep intervals.
Workloads I: Deployment & ReplicaSet
What do maxUnavailable and maxSurge control?
beginnerPromaxUnavailable caps how far below desired replica count the rollout can go. maxSurge caps how far above desired it can go temporarily. Both zero is invalid -- the rollout is impossible. Tuning them balances rollout speed vs capacity headroom.
How does kubectl rollout undo work mechanically?
beginnerProEach revision is backed by a retained ReplicaSet at zero replicas. Rollback simply scales the target previous ReplicaSet back up and the current one down -- the Pod template already exists, making rollback much faster than a fresh deploy.
Production incident involving Workloads I: Deployment & Repl
beginnerProWalk through systematic diagnosis: check events, logs, and metrics. Cross-reference observability data. Form a hypothesis and test before applying a fix.
Workloads II: StatefulSet & DaemonSet
What happens to a StatefulSet Pod's PVC when the Pod is deleted?
beginnerProThe PVC is NOT deleted. The replacement Pod for that ordinal reattaches to the same PVC, resuming with previous data intact.
How does a DaemonSet's reconciliation differ from a Deployment's?
beginnerProA Deployment reconciles toward a fixed replica count. A DaemonSet reconciles toward one Pod per eligible node -- adding a node creates a DaemonSet Pod, removing a node removes it.
Production incident with Workloads II: StatefulSet & Da
beginnerProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
Workloads III: Job & CronJob
What does concurrencyPolicy: Forbid do?
beginnerProPrevents a CronJob from starting a new Job if a previous run is still active -- new run is skipped.
What does activeDeadlineSeconds protect against?
beginnerProA Job hanging indefinitely if its work blocks. It enforces a hard ceiling on total Job runtime, turning a hang into a bounded failure.
Production incident with Workloads III: Job & CronJob
beginnerProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
Networking I: Services, Service Discovery & DNS
What is the relationship between ClusterIP, NodePort, and LoadBalancer?
beginnerProThey build in layers: ClusterIP provides base internal virtual IP. NodePort adds a port on every node. LoadBalancer adds a cloud-provisioned external LB pointing at the NodePort.
What is an EndpointSlice?
beginnerProObjects tracking which Pod IPs currently back a given Service, kept current by a dedicated controller. kube-proxy watches these to program forwarding rules.
Production incident with Networking I: Services, Servic
beginnerProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
Networking II: Ingress & Network Policies
What is the default network security posture between Pods?
intermediateProBy default every Pod can reach every other Pod with no restriction. NetworkPolicy objects are required to introduce any restriction.
What happens to a Pod's network traffic once any NetworkPolicy selects it?
intermediateProFor whichever direction the policy addresses, that Pod's traffic becomes default-deny except for explicit allows. Pods not selected remain fully open.
Production incident with Networking II: Ingress & Netwo
intermediateProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
Storage: Volumes, PVs, PVCs & StorageClass
What does ReadWriteOnce actually restrict?
intermediateProOne NODE at a time, not one Pod. Multiple Pods on the same node can mount and use an RWO volume simultaneously.
What does volumeBindingMode: WaitForFirstConsumer do?
intermediateProDelays dynamic provisioning until a Pod referencing the PVC is being scheduled, letting the Scheduler choose a zone-compatible node first.
Production incident with Storage: Volumes, PVs, PVCs &
intermediateProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
Scaling: HPA, VPA & Cluster Autoscaler
Why does HPA require resource requests for percentage-based CPU scaling?
intermediateProUtilization percentage is calculated relative to the Pod's requested resource value as a baseline denominator. Without a request, the percentage calculation has no basis.
Why can running HPA and VPA on the same metric cause problems?
intermediateProBoth react to the same signal (e.g., CPU) and can interact unpredictably in a feedback loop.
Production incident with Scaling: HPA, VPA & Cluster Au
intermediateProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
Scheduling: Affinity, Taints & Topology Spread
What are the three taint effects?
intermediateProNoSchedule prevents new untolerated Pods from being scheduled. PreferNoSchedule is the soft version. NoExecute evicts already-running Pods that don't tolerate it, optionally after tolerationSeconds.
What does IgnoredDuringExecution mean?
intermediateProRules are only evaluated at scheduling time. Once a Pod is placed, subsequent changes to node labels or taints do not retroactively evict or move the running Pod. Only NoExecute taints have ongoing eviction effect.
Production incident with Scheduling: Affinity, Taints &
intermediateProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
Security: RBAC, Service Accounts & Pod Security Standards
Why is RBAC described as purely additive with no explicit deny?
intermediateProA subject's effective permissions are the union of every Role/ClusterRole bound to it. There is no deny rule type. Anything not explicitly granted is denied by omission.
What is the difference between what RBAC and Security Context control?
intermediateProRBAC governs access to the Kubernetes API. Security Context governs what a container is allowed to do at the OS/kernel level once running. Completely independent layers.
Production incident with Security: RBAC, Service Accoun
intermediateProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
Observability: Prometheus, Grafana & AlertManager
What are recording rules?
intermediateProPre-computed PromQL expressions stored as new time-series, re-evaluated each cycle. Use them when a computation is expensive and queried frequently by dashboards or alerts.
What does AlertManager's deduplication prevent?
intermediateProPrometheus re-evaluates alerting rules every 15-30s so the same alert fires repeatedly. AlertManager collapses repeated firings to a configurable repeat_interval.
Production incident with Observability: Prometheus, Gra
intermediateProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
Packaging: Helm 3 & Kustomize
How does Kustomize differ philosophically from Helm?
advancedProHelm uses templating -- parameterized YAML rendered to final manifests. Kustomize uses explicit patches transforming plain YAML without any templating language.
What does helm rollback do mechanically?
advancedProEach revision is backed by a retained Secret. Rollback re-applies the stored manifest set from that revision, which is much faster than a fresh deployment.
Production incident with Packaging: Helm 3 & Kustomize
advancedProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
Deployment Strategies: Rolling, Blue-Green, Canary & Argo Rollouts
Why does native Kubernetes canary via replica ratio not give precise traffic percentages?
advancedProTraffic load-balances across all backing Pods regardless of version. 1 canary and 9 stable Pods gives approximately 10% canary -- not precise. Precise splitting requires an Ingress controller or service mesh with explicit traffic-weight rules.
What does Argo Rollouts AnalysisTemplate provide?
advancedProArgo Rollouts queries external metric providers during a rollout and automatically rolls back if success conditions are not met. Native Kubernetes has no concept of metric-gated deployment.
Production incident with Deployment Strategies: Rolling
advancedProCheck events with kubectl describe, examine logs, review metrics. Cross-reference Prometheus data. Form hypothesis and test before applying a fix.
CI/CD & GitOps: Jenkins, GitHub Actions & ArgoCD
What does ArgoCD's selfHeal do?
advancedProselfHeal causes ArgoCD to automatically revert manual kubectl changes that diverge from Git state. Git becomes absolutely authoritative -- direct kubectl edits to ArgoCD-managed resources are ephemeral and actively undone.
What does ArgoCD's prune option control?
advancedProprune: true causes ArgoCD to delete Kubernetes resources that exist in the cluster but no longer appear in Git. Without it, removed resources persist indefinitely, diverging cluster from Git state.
What is the difference between ArgoCD Synced/OutOfSync and Healthy/Degraded status?
advancedProSync status reflects whether the cluster matches Git. Health status reflects whether deployed resources are functioning. A resource can be Synced (matches Git) but Degraded (Pods crashing), or OutOfSync (differs from Git) but Healthy (current state works). Both are independently meaningful.
How does OIDC keyless authentication improve CI/CD security?
advancedProGitHub Actions generates a short-lived JWT token per workflow run that cloud providers exchange for temporary credentials scoped to that run. No long-lived access keys are stored in secrets, eliminating persistent credentials that can be leaked or misused after the pipeline is decommissioned.
After enabling selfHeal, on-call engineer patches replicas via kubectl during a traffic spike -- ArgoCD reverts it
advancedProThis is exactly correct selfHeal behavior. The right approach is committing the replica change to the GitOps config repo so ArgoCD sees it as the new desired state and applies it durably. Manual kubectl changes are not durable in a selfHeal-enabled GitOps setup.
CI commits image tag update to GitOps repo but ArgoCD shows app as OutOfSync 15 minutes later
advancedProIf ArgoCD uses polling with a long interval, the delay is expected. If webhooks are configured, check webhook delivery history in GitHub -- delivery may have failed. Also check ArgoCD controller logs for errors processing the new Git state.
Service Mesh: Istio, Envoy & mTLS
How does Istio provide mTLS without application code changes?
advancedProIstio injects an Envoy sidecar proxy into every Pod and configures iptables rules to intercept all traffic through the proxy. Applications communicate in plaintext on localhost; the proxy handles TLS termination, certificate presentation, and peer authentication transparently.
What is the difference between VirtualService and DestinationRule?
advancedProVirtualService defines routing rules -- how traffic for a destination is routed (weights, retries, fault injection, headers). DestinationRule defines the behavior for traffic once it has been routed to a specific service -- subsets (versions), load balancing policy, connection pool settings, and outlier detection (circuit breaking).
After enabling STRICT mTLS mesh-wide, a legacy monitoring agent starts failing to scrape application endpoints
advancedProThe monitoring agent is not in the mesh (no sidecar) so it sends plaintext traffic. STRICT mode rejects plaintext connections. Fix: enroll the monitoring namespace in the mesh, or create a PeerAuthentication exception for that specific port/workload, or switch to permissive mode for that namespace.
VirtualService configured with 10% canary weight but Prometheus shows 50% of traffic hitting the canary
advancedProCheck that DestinationRule with correct subset labels matches your Pod versions accurately. If subset selectors don't correctly identify which Pods are v1 vs v2, Envoy may not be routing as expected. Also verify the VirtualService is in the same namespace as the service or correctly references it.
Spring Boot on Kubernetes: Health Probes, Config, Scaling & Observability
What is the purpose of a startup probe vs a liveness probe?
advancedProThe liveness probe runs throughout the Pod's lifetime to detect hangs and trigger restarts. The startup probe runs only during startup and gives the application time to initialize. Without a startup probe, the liveness probe's timeout applies from the first second, killing newly started Pods before they finish JVM warm-up, data loading, or connection pool establishment.
How does server.shutdown: graceful work in Kubernetes?
advancedProWhen Kubernetes sends SIGTERM, Spring Boot stops accepting new HTTP requests but continues processing in-flight requests until they complete or spring.lifecycle.timeout-per-shutdown-phase is reached. Kubernetes's terminationGracePeriodSeconds must be longer than the graceful shutdown timeout, otherwise SIGKILL arrives and cuts off in-flight requests.
Spring Boot Pod restarts repeatedly in production with OutOfMemoryError
advancedProJVM exceeded its heap limit. Check: (1) container memory limit -- is it actually set? (2) -XX:MaxRAMPercentage or -Xmx value -- is the heap ceiling correct? (3) Heap dump/metrics -- is there a leak or sustained high allocation? With MaxRAMPercentage, also check whether non-heap (metaspace, direct buffers) is consuming unexpected memory in addition to heap.
Rolling deployment causes 502 errors even with graceful shutdown configured
advancedProCheck the relationship between terminationGracePeriodSeconds, the graceful shutdown timeout, and how quickly the load balancer removes the Pod from its backend pool. If the LB continues routing to a Pod that has already stopped accepting requests, 502s result. Also check readiness probe removal speed -- the EndpointSlice controller removes the Pod from Service endpoints after readiness fails, but there may be a propagation delay.
Production: HA, DR, Namespace Strategy & Cluster Hardening
What is the difference between cluster HA and application HA?
advancedProCluster HA means the Kubernetes management layer (control plane) can survive failures. Application HA means your application can continue serving traffic despite node or Pod failures. Both require independent design: 3-AZ control plane gives cluster HA; topology-spread Deployments with multiple replicas and PodDisruptionBudgets give application HA.
Why is testing etcd restore critical?
advancedProA backup that has never been successfully restored is not a verified backup. Corruption, format incompatibilities between etcd versions, or incomplete backup procedures may prevent restoration in an actual disaster. Quarterly restore drills verify the entire backup-and-restore process works under the conditions you would face in a real incident.
An AZ outage takes out 1 of 3 control plane nodes -- what happens?
advancedProWith 3 control plane nodes and 1 lost, etcd still has a quorum of 2. The cluster continues operating normally -- scheduling, failure recovery, and kubectl commands all work. The remaining 2 control plane nodes handle all API requests. Worker nodes in the affected AZ are lost (nodes become NotReady), their Pods are evicted and rescheduled to healthy nodes in surviving AZs.
A team fills their namespace's ResourceQuota -- new Pods cannot be created
advancedProResourceQuota enforcement is designed to prevent this from affecting other namespaces. The affected team needs to either clean up existing resources, request a quota increase, or optimize their resource requests/limits. Ops teams should monitor quota utilization as a leading indicator of capacity needs.
Top 100 Interview Questions Bank
Scenario & System Design Questions
Pod stuck in Pending, no events in kubectl describe pod
advancedProThe Scheduler has not processed this Pod at all -- check Scheduler Pod health. If FailedScheduling events exist, read the reason: Insufficient cpu, Taints not tolerated, or affinity rules not satisfiable are the most common causes.
Deployment rolling update stalled with 5/6 Pods at new version
advancedProThe 6th Pod is not passing readiness. Check kubectl logs on the new-version Pod and describe for events. The 5 existing ready Pods count against maxUnavailable so the rollout cannot remove one until the 6th is ready.
Service endpoints empty despite Pods being Running
advancedProThe Pod selector in the Service spec doesn't match the Pod labels, or all matching Pods are failing readiness. Use kubectl get endpointslices to verify, and check Pod conditions.
CronJob job misses scheduled runs for 3 hours
advancedProCheck whether startingDeadlineSeconds is set -- if it is too short and the cluster was briefly unavailable, missed runs beyond the deadline are permanently skipped. Also check concurrencyPolicy: Forbid with a long-running previous run.
StatefulSet postgres-1 rescheduled to a new node but shows missing data
advancedProData is present -- the new Pod is attached to the correct PVC (PVCs persist across Pod lifecycle). The issue is at the application or storage layer: check whether the PVC actually bound to the same underlying volume and whether the PV's data is intact.
ArgoCD shows OutOfSync but git shows the commit was made 20 minutes ago
advancedProCheck whether ArgoCD is polling or using webhooks. If polling, the default 3-minute interval means 20 minutes of OutOfSync is unusual -- check controller logs. If webhooks configured, check GitHub webhook delivery history for the failed delivery.
Prometheus shows target 'myapp' as DOWN
advancedProDOWN means Prometheus cannot scrape /metrics. Check: (1) is the Pod running and healthy? (2) Is the service port correct in the ServiceMonitor? (3) Is there a NetworkPolicy blocking Prometheus? (4) Is the metrics endpoint actually exposed at the configured path?
Node NotReady -- what is your diagnostic sequence?
advancedProCheck kubectl describe node for Conditions (MemoryPressure, DiskPressure, PIDPressure). Check node-problem-detector logs if installed. SSH to node and check kubelet status. Check system dmesg for OOM kill or disk errors.
LoadBalancer Service has no EXTERNAL-IP after 5 minutes
advancedProThe cloud controller hasn't provisioned the LB. Check events on the Service. If on a bare-metal cluster, no cloud controller exists -- use MetalLB or NodePort instead. If on a cloud, check cloud-provider annotations and IAM permissions.
All Pods in a namespace fail with ImagePullBackOff
advancedProThe image registry credentials are missing or expired. Check whether an imagePullSecret is configured on the ServiceAccount or Pod spec. Verify the Secret exists and the credentials are valid.
HPA not scaling despite high CPU -- stuck at current replica count
advancedProCheck: (1) Is Metrics Server installed and running? (2) Does kubectl top pods show data? (3) Are resource requests set on the Pods (required for HPA percentage calculation)? (4) Is current replica count at maxReplicas?
Ingress routes traffic correctly to Service A but 404s for Service B
advancedProCheck the Ingress rules -- verify host, path, and pathType for Service B match exactly. Check whether Service B has healthy Endpoints. Check Ingress controller logs for routing decisions.
Cluster Autoscaler not adding nodes despite Pending Pods
advancedProCheck CA logs for 'unschedulable' reasons. CA only adds nodes if the Pods are unschedulable due to resource constraints. Pods blocked by taints/affinity that no node pool could satisfy won't trigger scale-out.
Spring Boot Pod restarts with OOMKilled
advancedProJVM heap exceeded container memory limit. Fix: (1) Increase container memory limit. (2) Add -XX:MaxRAMPercentage=75 so JVM respects the container limit. (3) Verify non-heap (metaspace, direct buffers) is not excessive.
kubectl apply of a large manifest takes 30+ seconds
advancedProCheck API Server load (high QPS). Large CRD schemas with expensive validation webhooks can add latency. Also check etcd write latency. Consider using kubectl diff first to verify only changed resources are being applied.
Istio sidecar injection enabled but Pods not getting sidecar
advancedProCheck the namespace label (istio-injection: enabled). Also check whether there is an annotation on the Pod spec disabling injection (sidecar.istio.io/inject: 'false'). New Pods pick up the setting but existing Pods need deletion and recreation.
NetworkPolicy applied but traffic still flows between namespaces
advancedProThe CNI plugin doesn't enforce NetworkPolicy (e.g., Flannel without policy support). Or the policy selector is incorrect. Test enforcement with a specific deny-all policy and verify traffic is actually blocked.
etcd is running but API Server reports unhealthy
advancedProCheck etcd certificate expiry (common cause of etcd-API Server communication failure). Check network connectivity between API Server and etcd endpoints. Check etcd disk usage -- a full disk causes etcd to stop processing writes.
Deployment update completes successfully but application behavior hasn't changed
advancedProA possible ConfigMap or Secret issue -- the application may cache config at startup. Check whether the relevant ConfigMap or Secret was updated. If volume-mounted, the file may have updated but the application hasn't reloaded. If env var, a rolling restart is needed.
PodDisruptionBudget blocks node drain indefinitely
advancedProThe PDB's minAvailable constraint cannot be satisfied -- the number of ready replicas is already at or below the minimum. Either scale up the Deployment first, or temporarily adjust the PDB (with care) before draining.