Skip to content

feat: list available endpoints in /statusz for kubelet #133199

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ylink-lfs
Copy link
Contributor

@ylink-lfs ylink-lfs commented Jul 25, 2025

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Previously api-machinery members removed the hard-coded paths (/healthz, /livez, /readyz) in staging package. Should restore the 'Useful links' used by kubelet.

Which issue(s) this PR is related to:

Umbrella issue: #132474
Fixes: #133184

Special notes for your reviewer:

Tested locally with a custom build of kube-proxy confirming that /statusz correctly shows the listed endpoints.

root@kind-control-plane:/# curl -k https://127.0.0.1:10250/statusz

kubelet statusz
Warning: This endpoint is not meant to be machine parseable, has no formatting compatibility guarantees and is for debugging purposes only.

Started  Sun Jul 27 07:20:34 UTC 2025
Up  0 hr 00 min 06 sec
Go version  go1.24.5
Binary version  1.34.0-beta.0.536+31076958877bcb-dirty
Emulation version  1.34
Paths   /healthz /metrics /pods /stats

Does this PR introduce a user-facing change?

The `/statusz` handle for kubelet now includes a list of exposed endpoints, making it easier to debug and introspect.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

NONE

@Copilot Copilot AI review requested due to automatic review settings July 25, 2025 01:39
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 25, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ylink-lfs
Once this PR has been reviewed and has the lgtm label, please assign cheftako for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from matthyx and mrunalp July 25, 2025 01:40
@k8s-ci-robot k8s-ci-robot added sig/node Categorizes an issue or PR as relevant to SIG Node. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 25, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 25, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR restores the display of useful endpoint links in the kubelet's /statusz page. The change adds a list of important kubelet endpoints (/livez, /readyz, /healthz, /metrics) to the statusz registry, making them visible on the status page for easier debugging and introspection.

  • Adds endpoint listing functionality to the kubelet's /statusz handler
  • Includes four key endpoints: health checks and metrics

@k8s-ci-robot
Copy link
Contributor

Hi @ylink-lfs. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@matthyx
Copy link
Contributor

matthyx commented Jul 25, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 25, 2025
@ylink-lfs ylink-lfs force-pushed the feature/kubelet_statusz_endpoint branch from 3f1f77c to 660bd61 Compare July 25, 2025 12:26
@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 25, 2025
statusz.Install(s.restfulCont, ComponentKubelet, statusz.NewRegistry(
compatibility.DefaultBuildEffectiveVersion(),
statusz.WithListedPaths([]string{
"/livez",

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the path declaration, PTAL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont want to hardcode the paths here, since the paths exposed can change with every release. We should do something similar to what we are doing for apiserver here i.e. make use of the handler's ListedPaths() to get the true list of exposed paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont want to hardcode the paths here, since the paths exposed can change with every release. We should do something similar to what we are doing for apiserver here i.e. make use of the handler's ListedPaths() to get the true list of exposed paths.

I implemented a commit based on the example you provided. PTAL if my idea is correct?

@ylink-lfs ylink-lfs force-pushed the feature/kubelet_statusz_endpoint branch 2 times, most recently from 3107695 to 4b3481f Compare July 27, 2025 07:21
@ylink-lfs ylink-lfs force-pushed the feature/kubelet_statusz_endpoint branch from 7a6c1b5 to 652972f Compare July 29, 2025 13:52
@ylink-lfs ylink-lfs force-pushed the feature/kubelet_statusz_endpoint branch from 652972f to 416a7e7 Compare August 1, 2025 01:19
@k8s-ci-robot
Copy link
Contributor

@ylink-lfs: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-e2e-gce 416a7e7 link true /test pull-kubernetes-e2e-gce

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Development

Successfully merging this pull request may close these issues.

List available endpoints for kubelet's /statusz
5 participants