-
Notifications
You must be signed in to change notification settings - Fork 769
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
gRPC health checks in kubernetes scenario - unable to execute on demand only subset of healthchecks #2141
Comments
|
Thanks @JamesNK for explanation. The use case I have is to setup kubernetes liveness and startup probes to use different filters (to check different things - similar expectation was stated in #1963) and have it executed on demand when grpc health-check is called (frequency set in kubernetes). It seems I cannot configure and control which check is executed when to follow the rule to have 'clever' startup tests (e.g checking external service dependencies) and 'dumb' liveness checks (e.g. checking just grpc stack being responsive). I suggest to use |
HealthCheckPublisherOptions doesn't do anything for you here. You're not calling Watch and you're not caching results. I don't understand what the problem is. Your first issue said that a health check wasn't running when you expected it to:
Now you're saying too many health checks are running:
|
The problem is that I cannot limit the checks that are executed in the liveness probe. |
Potential solution could be to:
HealthCheckResponse.Types.ServingStatus status;
if (_grpcHealthCheckOptions.Services.TryGetServiceMapping(service, out var serviceMapping))
{
var result = await _healthCheckService.CheckHealthAsync(
(r) =>
(_healthCheckOptions.Predicate == null || _healthCheckOptions.Predicate(r))
&& serviceMapping.ExecutionPredicate(r),
cancellationToken
);
status = HealthChecksStatusHelpers.GetStatus(result, serviceMapping.Predicate);
} |
Ok, I understand. Rather than have two predicates, what I'd like to do is:
|
What version of gRPC and what language are you using?
2.53.0
What operating system (Linux, Windows,...) and version?
macos
What runtime / compiler are you using (e.g. .NET Core SDK version
dotnet --info
)6.0.16
What did you do?
Trying to configure kubernetes grpc healthchecks for my service.
I want to have different healthchecks executed on demand for startup and liveness probe.
I've tried to use the following configuration:
What did you expect to see?
grpc_cli call IP:PORT grpc.health.v1.Health/Check "service: 'startup'"
will run only checks tagged withstartup
grpc_cli call IP:PORT grpc.health.v1.Health/Check "service: 'liveness'"
will run only checks tagged withliveness
What did you see instead?
grpc_cli call IP:PORT grpc.health.v1.Health/Check "service: 'startup'"
doesnt not runstartup
tagged checks at all!Code hint
In the newest code I've found that the CheckHealthAsync is executed with different predicate than GetStatus. Is it by design?
The text was updated successfully, but these errors were encountered: