-
Notifications
You must be signed in to change notification settings - Fork 199
Move server metrics to health port #751
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
base: master
Are you sure you want to change the base?
Conversation
|
Welcome @aldudko! |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aldudko The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @aldudko. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Signed-off-by: Alex Dudko <[email protected]>
/ok-to-test |
@ipochi I'm fine with the change. I think the only real concern would be backward compatibility. Arguably with admin port bound to localhost then it seems unlikely that anyone if relying on scraping from the port. Are you ok as is or do you think which should ask for a backward compatibility mode flag? |
@@ -422,7 +422,17 @@ func (p *Proxy) runAgentServer(o *options.ProxyRunOptions, server *server.ProxyS | |||
|
|||
func (p *Proxy) runAdminServer(o *options.ProxyRunOptions, _ *server.ProxyServer) error { | |||
muxHandler := http.NewServeMux() | |||
muxHandler.Handle("/metrics", promhttp.Handler()) | |||
muxHandler.Handle("/metrics", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My 2 cents: just leave the metrics handler in both places unconditionally, and add a comment that admin server is only for backward compatibility.
Otherwise, nice to add some unit test coverage of this redirect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to the agent, run /metrics endpoint on the health port instead of the admin port.
By default, adminServer binds to localhost, which doesn't let prometheus to scrap server's /metrics.
If I bind adminServer to podIP, /debug/ endpoints will be exposed too since they are served by the same adminServer.
It is more secure to keep /debug on localhost and expose metrics on podIP:healthPort
https://kubernetes.slack.com/archives/CPS4Z8G8N/p1749655050637769
How was this tested?