Help! I’m Getting a 404 When Accessing Backend Through Ingress

0
0
Asked By CuriousCoder42 On

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

Answered By DevDude22 On

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!

CuriousCoder42 -

Thanks for the tip! I think the problem was indeed linked to running Kubernetes in that environment.

DevDude22 -

Glad to hear you figured it out! Always a bit tricky setting up that technology stack.

Answered By TechGuru99 On

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.

TechGuru99 -

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!

CuriousCoder42 -

I haven't tried the `Exact` path type yet, but I will give that a shot.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.