Interview Prep/Kubernetes/Services, Ingress and DNS

ingress-nginx returns 502 or 503 intermittently. What are the likely reasons?

IntermediateScenarioServices, Ingress and DNS
Answer

Situation read → Errors appear during deploys and under load.

What I'd do →

  1. 503 means no ready endpoints for the backend, 502 means the upstream closed or refused
  2. kubectl get endpoints to see readiness gaps
  3. Check pod restarts and OOMKills with kubectl get pods
  4. Raise proxy-read-timeout or fix slow upstreams if you see 504
  5. Add preStop sleep and graceful shutdown for deploy-time errors

Why → Ingress sends traffic to pod IPs directly, so any pod that is shutting down or unready can cause 5xx.

Interview tip → Memorise the mapping: 502 bad upstream, 503 no upstream, 504 upstream timeout.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, Ingress and DNS