mediumIntermediateSymptom-first#ingress#404#502#nginx

Ingress returns 404/502 — backend service unresolved

curl to the Ingress host returns 404 Not Found or 502

Likely source:connectivity

Focused incident mode — strips away everything but this runbook.

Symptoms

  • curl to the Ingress host returns 404 Not Found or 502
  • Ingress controller logs: 'no service in kubernetes.io/ingress class' or 'backend not found'
  • LoadBalancer IP responds but route fails

Evidence to grab

Collect these artifacts before you change anything — they prove (or rule out) each cause.

  • Ingress backend ref

    kubectl get ingress <name> -n <namespace> -o yaml | grep -A5 backends
  • Ingress controller logs

    kubectl logs -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx --tail=100

Diagnostic flow

Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.

Guided decision tree is ready.

Steps with commands, expected output, and pass/fail branches.

Ranked root causes

Evidence checklist

  • Ingress says service 'api' but the Service is named 'api-v2'
  • Controller logs 'service ... not found'

Confirm before fixing

kubectl get svc -n <namespace>
READ

List real Service names/ports

Fix

kubectl edit ingress <name> -n <namespace>
CHANGE

Point the backend at the correct name/port

Resolution runbook

Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.

1
curl -I http://<ingress-host>/<path>
READ

Capture the failing status

Expected: HTTP/1.1 404 or 502

2
kubectl get svc,ingress,endpoints -n <namespace>
READ

Compare the whole chain

3
kubectl logs -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx --tail=100
READ

Read the controller's decision on the request

Prevention

  • Generate Ingress from a manifest template so names/ports stay in sync.
  • Add a post-deploy smoke test on the Ingress host.
  • Follow service-no-endpoints checks as part of Ingress deploys.

Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.