Troubleshoot an Ingress That Returns 404 Not Found
Scenario
The bose-einstein Deployment runs nginx in the physics namespace. It is exposed through the bose-einstein Ingress at http://bose.physics.local, but the address returns 404 page not found.
nginx in the Pods is healthy and listens on port 9090. The files the team applied are on cplane-01. Only ingress.yaml and service.yaml are misconfigured. Do not change the other files:
/home/laborant/bose-einstein/
├── default.conf # do not change
├── deployment.yaml # do not change
├── index.html # do not change
├── ingress.yaml # misconfigured
└── service.yaml # misconfigured
Task
Make the necessary changes to the misconfigured files in /home/laborant/bose-einstein/ and apply them, so that the application is reachable at http://bose.physics.local.
Do not change or recreate the bose-einstein Deployment. Keep the Ingress host bose.physics.local, and do not change Traefik.
Hint 1 | Following a request from the Ingress to the Pod
A request passes through the Ingress, then the Service, then a Pod. Check each link in turn:
kubectl describe ingress <name> -n <namespace>
kubectl describe service <name> -n <namespace>
kubectl get endpointslices -n <namespace>
kubectl get pods -n <namespace> --show-labels
Hint 2 | Which port goes where
Three different fields hold a port, and each one points to the next:
| Field | Points to |
|---|---|
Ingress backend.service.port | A port of the Service |
Service port | The port the Service exposes |
Service targetPort | The port the container listens on |