-
Notifications
You must be signed in to change notification settings - Fork 41.1k
kube-proxy: list available endpoints in /statusz #133190
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
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
Hi @aman4433. Thanks for your PR. I'm waiting for a kubernetes 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aman4433 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 |
cc: @richabanker |
@@ -486,7 +486,15 @@ func serveMetrics(ctx context.Context, bindAddress string, proxyMode kubeproxyco | |||
} | |||
|
|||
if utilfeature.DefaultFeatureGate.Enabled(zpagesfeatures.ComponentStatusz) { | |||
statusz.Install(proxyMux, kubeProxy, statusz.NewRegistry(compatibility.DefaultBuildEffectiveVersion())) | |||
statusz.Install(proxyMux, kubeProxy, statusz.NewRegistry(compatibility.DefaultBuildEffectiveVersion(), | |||
statusz.WithListedPaths([]string{ |
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.
This paths are actually path strings from actual handlers, which could be changed separately and bring inconsistency. Wouldn't it be better to introduce constant variables with string or something like that, so that path strings are changed in single place?
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.
Thanks for the suggestion! Just to confirm — is it okay if I define constants for these paths locally in server.go (e.g., livezPath = "/livez") and reuse them in WithListedPaths()?
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.
here is similar PR, it should help you in some way #133199
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.
Thanks for sharing the reference PR! I’ve updated the code to follow a similar pattern — hope this is what you were expecting. Let me know if anything else needs tweaking!
Please note that you need to verify the existence of all listed HTTP routes by making localhost requests to each one. |
1103f21
to
3d85034
Compare
Thanks for the reminder! Verified each listed endpoint with localhost curl requests:
|
Ah, sorry for the duplicated effort here, seems like #133239 is already fixing the issue correctly by getting the list of paths from the mux rather than hard coding them. Edit: Oh this one is for kube-proxy, my bad. Its not duplicated then. But can we make sure to obtain the list of paths from the handler rather than hard code them? |
Thanks for the feedback and for referencing PR #133239. According to my investigation, the kubelet's approach is possible because its HTTP router (restful.Container) has a public method to get registered paths. From what I could find, kube-proxy's router (PathRecorderMux) doesn't seem to expose a similar method. This was what prevented me from querying the handler dynamically. I'm very open to other ideas, though. Is there a better approach you're aware of that I might have missed? |
There is a ListedPaths() method for the proxyMux here that you could use. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This PR adds a list of available HTTP endpoints for the kube-proxy component under the /statusz page. It enhances the visibility of active health/metrics/debug endpoints for instrumentation and operational introspection.
It follows the pattern introduced for other control plane components like kube-apiserver, kube-scheduler, and kube-controller-manager.
Which issue(s) this PR is related to:
Fixes: #133185
Part of umbrella issue: #132474
Special notes for your reviewer:
Tested locally with a custom build of kube-proxy confirming that /statusz correctly shows the listed endpoints.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: