Kubernetes interview question · Most asked
Your application on Kubernetes has intermittent 502/503 errors during deployments. What would you investigate?
Summary
Look at readiness and shutdown behaviour first: pods receiving traffic before they are ready (missing or wrong readiness probe), pods killed while the load balancer still routes to them (no SIGTERM handling, no preStop delay, too-short grace period), and keep-alive connections held to terminating pods. Then check rollout settings and capacity.
Longer Answer
Checklist: does readiness reflect real readiness (warm-up, connections established)? Does the app drain on SIGTERM? Is there a preStop sleep long enough for endpoint propagation and the external load balancer's deregistration delay? Does maxUnavailable drop capacity too far? Are idle timeouts of the load balancer and the app aligned (the app's keep-alive timeout should be longer than the load balancer's)? Correlate error timestamps with pod lifecycle events.
Key Points
- Readiness before traffic.
- Graceful shutdown + preStop delay.
- Keep-alive and idle timeout alignment.
- Rollout capacity settings.
Deep dive: Resilience Patterns
More most-asked Kubernetes questions
- ConfigMaps and Secrets: how do they differ, and how should secrets really be handled?
- How does the scheduler place pods? Explain resource requests, node affinity, taints and tolerations.
- Describe the Kubernetes architecture: what runs on the control plane and what runs on the nodes?
- How do rolling updates work in a Deployment, and how do you roll back?
- Explain the Service types: ClusterIP, NodePort, LoadBalancer, ExternalName and headless.
- What happens, step by step, when you run kubectl apply for a Deployment?
- Deployment, StatefulSet, DaemonSet, Job and CronJob: when do you use each?
- What is the difference between resource requests and limits, and what are the QoS classes?