I'm experiencing a frustrating issue where I keep getting a 404 error when trying to access my backend API through Ingress. I've set up my frontend and backend deployments and services in Kubernetes, but regardless of whether I use curl from my local machine or send a request from my frontend app, I get the same 404 response.
It's important to point out that my Ingress controller is running, and the backend routes are not expecting any additional "api" path prefix. I can access the backend routes perfectly fine when shelling into the frontend pod and using the cluster network. I've double-checked my routes, and I know I'm targeting valid paths without typos.
I've added some logging in my backend to capture incoming requests, but nothing logs when I'm trying to access via Ingress, which makes me think the requests might not even be reaching the backend service. I also suspect that running Kubernetes on Docker Desktop with WSL rather than something like Minikube might be at the heart of the issue. Any insights or advice on how to troubleshoot this would be greatly appreciated!
2 Answers
It sounds like you might have resolved your issue by experimenting with the setup. Just a heads up, I ran into something similar when using Docker Desktop with WSL. There can be configurations that act differently than expected. Make sure to verify that your Ingress is set up correctly in relation to your services!
Glad to hear you figured it out! Always a bit tricky setting up that technology stack.
Have you checked how the nginx Ingress controller is handling the `ImplementationSpecific` path type? I would suggest trying out the `Exact` path type instead to see if that alters the behavior. Sometimes, the way paths are processed can affect the routing.
Let me know if that works for you. Also, I saw you edited your question to mention that requests don't seem to reach the server at all. That's definitely a key point!
I haven't tried the `Exact` path type yet, but I will give that a shot.
Thanks for the tip! I think the problem was indeed linked to running Kubernetes in that environment.