Kubernetes Service Discovery 404 in NET Core 3 App

11/18/2019

Im not sure if im doing something wrong here, maybe you guys can help me out.

I have 2 net core APIs in a kubernetes cluster in the same namespace - according to documentation I should be able to hit the API using service discovery - this is the route im hitting http://sourceapi-service.dev.svc.cluster.local with a get. The naming is correct of the service and the namespace.

When I check the logs I see that the API does receive the request but 404s while trying to find a controller action that matches the request.

[15:05:02 INF] Request starting HTTP/1.1 GET http://sourceapi- 
service.dev.svc.cluster.local//api/Customer/HOLI15
[15:05:02 DBG] Wildcard detected, all requests with hosts will be allowed.
[15:05:02 DBG] No candidates found for the request path '//api/Customer/HOLI15'
[15:05:02 DBG] Request did not match any endpoints
[15:05:02 DBG] The request path  does not match the path filter
[15:05:02 DBG] Connection id "0HLRC72O1EQ8J" completed keep alive response.
[15:05:02 INF] Request finished in 51.0505ms 404

When I make the request via my ingress it works just fine.

What am I doing wrong ? Is there some sort of proxy rules that I need to setup?

-- cl0ud
asp.net-core
kubernetes

1 Answer

11/18/2019

Well this is embarrassing.

The double / in the route broke it . I changed //api/Customer/HOLI15 to /api/Customer/HOLI15 and it worked.

Nothing to see here.

-- cl0ud
Source: StackOverflow