-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Health checks return 404 code #2360
Comments
If you only set controller-runtime/pkg/manager/manager.go Lines 634 to 644 in 30eae58
Perhaps you should use $ nc -vz 127.0.0.1 8081
Connection to 127.0.0.1 8081 port [tcp/tproxy] succeeded! Furthermore, if you need to customize your probe handel logic, you can add a healthz.Checker to mgr, then TCP server --> HTTP server and work according to the registered handler: mgr, err := ctrl.NewManager(
ctrl.GetConfigOrDie(),
ctrl.Options{
Scheme: scheme,
HealthProbeBindAddress: ":8081",
},
)
if err != nil {
os.Exit(1)
}
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
os.Exit(1)
}
if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
os.Exit(1)
} Send a HTTP request: $ curl -X GET -v http://127.0.0.1:8081/healthz
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 127.0.0.1:8081...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8081 (#0)
> GET /healthz HTTP/1.1
> Host: 127.0.0.1:8081
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Fri, 02 Jun 2023 06:43:54 GMT
< Content-Length: 2
<
* Connection #0 to host 127.0.0.1 left intact |
@iiiceoo Thank you very much it worked! I missed the fact that by default it TCP only. |
All health checks are return 404 code by default.
In the docs it said that by default endpoints should be
healthz
andreadyz
But when checking it with
curl -XGET http://127.0.0.1:8080/healthz
it returns 404, since by default it's metrics endpoint (undocumented).When configuring a separate health endpoint
Heath probes still return 404
Is there a way to enable health checks with controller runtime?
controller-runtime version is
v0.15.0
The text was updated successfully, but these errors were encountered: