☸️

Kubernetes Interview Questions

Pods, Deployments, Services, networking, storage, scaling, scheduling, security & production operations.

← Learn this topic from scratch first

Kubernetes Architecture: Control Plane & Worker Nodes

Core Components: API Server, etcd, Scheduler, Controller Manager, Kubelet & Kube-Proxy

Pods: Lifecycle, Init Containers & Sidecars

Workloads I: Deployment & ReplicaSet

Deployment Strategies: Rolling, Blue-Green, Canary & Argo Rollouts

CI/CD & GitOps: Jenkins, GitHub Actions & ArgoCD

Q

What does ArgoCD's selfHeal do?

advancedPro

selfHeal 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.

Q

What does ArgoCD's prune option control?

advancedPro

prune: 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.

Q

What is the difference between ArgoCD Synced/OutOfSync and Healthy/Degraded status?

advancedPro

Sync 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.

Q

How does OIDC keyless authentication improve CI/CD security?

advancedPro

GitHub 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.

Q

After enabling selfHeal, on-call engineer patches replicas via kubectl during a traffic spike -- ArgoCD reverts it

advancedPro

This 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.

Q

CI commits image tag update to GitOps repo but ArgoCD shows app as OutOfSync 15 minutes later

advancedPro

If 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

Q

How does Istio provide mTLS without application code changes?

advancedPro

Istio 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.

Q

What is the difference between VirtualService and DestinationRule?

advancedPro

VirtualService 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).

Q

After enabling STRICT mTLS mesh-wide, a legacy monitoring agent starts failing to scrape application endpoints

advancedPro

The 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.

Q

VirtualService configured with 10% canary weight but Prometheus shows 50% of traffic hitting the canary

advancedPro

Check 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

Q

What is the purpose of a startup probe vs a liveness probe?

advancedPro

The 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.

Q

How does server.shutdown: graceful work in Kubernetes?

advancedPro

When 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.

Q

Spring Boot Pod restarts repeatedly in production with OutOfMemoryError

advancedPro

JVM 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.

Q

Rolling deployment causes 502 errors even with graceful shutdown configured

advancedPro

Check 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

Q

What is the difference between cluster HA and application HA?

advancedPro

Cluster 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.

Q

Why is testing etcd restore critical?

advancedPro

A 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.

Q

An AZ outage takes out 1 of 3 control plane nodes -- what happens?

advancedPro

With 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.

Q

A team fills their namespace's ResourceQuota -- new Pods cannot be created

advancedPro

ResourceQuota 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.

Scenario & System Design Questions

Q

Pod stuck in Pending, no events in kubectl describe pod

advancedPro

The 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.

Q

Deployment rolling update stalled with 5/6 Pods at new version

advancedPro

The 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.

Q

Service endpoints empty despite Pods being Running

advancedPro

The 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.

Q

CronJob job misses scheduled runs for 3 hours

advancedPro

Check 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.

Q

StatefulSet postgres-1 rescheduled to a new node but shows missing data

advancedPro

Data 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.

Q

ArgoCD shows OutOfSync but git shows the commit was made 20 minutes ago

advancedPro

Check 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.

Q

Prometheus shows target 'myapp' as DOWN

advancedPro

DOWN 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?

Q

Node NotReady -- what is your diagnostic sequence?

advancedPro

Check 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.

Q

LoadBalancer Service has no EXTERNAL-IP after 5 minutes

advancedPro

The 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.

Q

All Pods in a namespace fail with ImagePullBackOff

advancedPro

The 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.

Q

HPA not scaling despite high CPU -- stuck at current replica count

advancedPro

Check: (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?

Q

Ingress routes traffic correctly to Service A but 404s for Service B

advancedPro

Check 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.

Q

Cluster Autoscaler not adding nodes despite Pending Pods

advancedPro

Check 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.

Q

Spring Boot Pod restarts with OOMKilled

advancedPro

JVM 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.

Q

kubectl apply of a large manifest takes 30+ seconds

advancedPro

Check 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.

Q

Istio sidecar injection enabled but Pods not getting sidecar

advancedPro

Check 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.

Q

NetworkPolicy applied but traffic still flows between namespaces

advancedPro

The 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.

Q

etcd is running but API Server reports unhealthy

advancedPro

Check 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.

Q

Deployment update completes successfully but application behavior hasn't changed

advancedPro

A 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.

Q

PodDisruptionBudget blocks node drain indefinitely

advancedPro

The 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.