Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting 404 on /healthz GET from K8 liveliness and readiness probes #2261

Open
tomfanara opened this issue Feb 27, 2025 · 1 comment
Open
Labels
question Initially seen a question could become a new feature or bug or closed ;)

Comments

@tomfanara
Copy link

tomfanara commented Feb 27, 2025

Hello, I am getting this error

Ocelot.Responder.Middleware.ResponderMiddleware[0]
      requestId: 0HNAMQUQ686Q7:00000001, previousRequestId: No PreviousRequestId,
message: '
   Error Code: UnableToFindDownstreamRouteError
   Message: Failed to match Route configuration for upstream path: /healthz, verb: GET.
   errors found in ResponderMiddleware. Setting error response for request path:/healthz, request method: GET
'
warn: Ocelot.DownstreamRouteFinder.Middleware.DownstreamRouteFinderMiddleware[0]

I have my routes as follows and I have an endpoint handler for /healthz so do I also need a route for this? The probes just want a http 200 back from the app not a routing.

{
  "Routes": [
    {
      "DownstreamPathTemplate": "/v1/api/employee?{Id}",
      "DownstreamScheme": "https",
      "UpstreamPathTemplate": "/wca/v1/api/employee?{Id}",
      "ServiceName": "templateapi",
      "UpstreamHttpMethod": [ "Get" ]
    },
    {
      "DownstreamPathTemplate": "/v1/api/employee",
      "DownstreamScheme": "https",
      "UpstreamPathTemplate": "/wca/v1/api/employee",
      "ServiceName": "templateapi",
      "UpstreamHttpMethod": [ "POST" ]
    }
    ],
    "GlobalConfiguration": {
      "ServiceDiscoveryProvider": {

        "Type": "KubernetesServiceDiscoveryProvider",
        "Namespace": "template-api"

      }
    }
}

also here is my program.cs

var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddJsonFile("Routes/ocelot.prod.json");

builder.Services.AddOcelot().AddConsul(); // or .AddConsul<T>()

builder.Services.AddLocal(builder, builder.Configuration);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddCarter();

var app = builder.Build();

app.UseRouting();
app.UseAuthorization();
app.MapCarter();

// Use Ocelot
app.UseOcelot().Wait();

app.Run();
@raman-m
Copy link
Member

raman-m commented Feb 27, 2025

@tomfanara Hello, Tom!

Please send a brief message to [email protected] with the link to this issue, and we will discuss your problem.
I would appreciate it if you could share your LinkedIn profile in the email.

Thank you!

@raman-m raman-m added the question Initially seen a question could become a new feature or bug or closed ;) label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Initially seen a question could become a new feature or bug or closed ;)
Projects
None yet
Development

No branches or pull requests

2 participants