Bird
0
0

You see 404 errors when accessing your service through Nginx Ingress. The Ingress YAML is:

medium📝 Troubleshoot Q7 of 15
Kubernetes - Ingress
You see 404 errors when accessing your service through Nginx Ingress. The Ingress YAML is:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /app
        pathType: Prefix
        backend:
          service:
            name: app-service
            port:
              number: 80
What is a likely cause?
AThe host 'example.com' is misspelled
BThe client is requesting '/' instead of '/app' path
CThe annotation is incorrect for Nginx
DThe service port 80 is closed
Step-by-Step Solution
Solution:
  1. Step 1: Analyze path in Ingress

    The Ingress routes only requests starting with '/app'. Requests to '/' won't match.
  2. Step 2: Understand 404 cause

    Requests to '/' get no matching rule, causing 404 errors.
  3. Final Answer:

    The client is requesting '/' instead of '/app' path -> Option B
  4. Quick Check:

    Path mismatch causes 404 errors [OK]
Quick Trick: Match client request path with Ingress path [OK]
Common Mistakes:
  • Blaming service port without checking path
  • Assuming annotation is wrong
  • Ignoring host correctness

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes