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

K8s Service Discovery Endpoint connection against https endpoints does not seem to work #2318

Open
derbach opened this issue Nov 19, 2024 · 0 comments

Comments

@derbach
Copy link

derbach commented Nov 19, 2024

Please, fill the following sections to help us fix the issue

What happened:
We added the HealthChecks Lib to our C# application and also created the mandatory service account, clusterrole and clusterrolebinding. The discovery in itself works. The services with Label "Healthchecks: enabled" are found and correctly resolved. However, when sending the http request, there is no response (according to the log atleast). When we exec into our pod and manually issue a request via curl/wget using the Service IP (which is correctly resolved and logged from the HealthCheck Lib), we get the expected health report. Please note, that the requests work against http endpoints and only seem to fail against https.

What you expected to happen:
We would expect the requests to our service endpoint to correctly return the health status or atleast to display an error message.
It seems like the request is timing out maybe?

How to reproduce it (as minimally and precisely as possible):
Add HealthChecksUI with enabled K8sDiscovery to C# application and create mandatory k8s ressources to enable service discovery.

Source code sample:
Appsettings.json
"HealthChecksUI": { "EvaluationTimeInSeconds": 15, "HealthChecks": [ { "Name": "HTTP-Api-Basic", "Uri": "https://172.20.147.160/healthz" // this manual check works.. this exact uri is also logged by k8sdiscovery, but no connection. } ], "KubernetesDiscoveryService": { "Enabled": true, "HealthPath": "health", "ServicesLabel": "HealthChecks", "ServicesPathAnnotation": "HealthChecksPath", "ServicesPortAnnotation": "HealthChecksPort", "ServicesSchemeAnnotation": "HealthChecksScheme", "RefreshTimeOnSeconds": 10 } }

In our C# application:
app.UseRouting().UseEndpoints(config => config.MapHealthChecksUI());

services.AddHealthChecksUI(setup => { setup.UseApiEndpointHttpMessageHandler(sp => { return new HttpClientHandler { ClientCertificateOptions = ClientCertificateOption.Manual, ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => true, // NOSONAR }; }); }).AddInMemoryStorage();

Anything else we need to know?:
These are our log messages:

Environment:

  • Development
  • .NET Core version: 8.0
  • Healthchecks version: 8.0.1
@derbach derbach changed the title K8s Service Discovery Endpoint connection does not seem to work K8s Service Discovery Endpoint connection against https endpoints does not seem to work Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant