Skip to content

Add readiness check for metrics server when using `WithAuthenticationAndAuthorization() #3238

Open

Description

@camilamacedo86

We’ve observed that when using WithAuthenticationAndAuthorization() (with self-signed certs), the metrics server may take a few seconds to become available on Kubernetes 1.33+.

In particular, some Kubebuilder tests started failing against 1.33, where they were still passing in previous versions < 1.33. After debugging, the root cause seems to be a delay related to how Kubernetes 1.33 handles token availability and cert readiness, likely due to changes in the API server behaviour.

To solve our tests for 1.33+ we added a delay: https://github.com/kubernetes-sigs/kubebuilder/pull/4882/files

Just an Idea

It might be nice if controller-runtime could provide a ReadyzCheck for the metrics server. That would help in scenarios using either self-signed or provided certs, by allowing consumers to verify the /metrics endpoint is actually ready (serving over HTTPS and accepting tokens) before probing or testing.

Thanks for your work and for considering this 🙌

Activity

  1. sbueringer commented on Jun 28, 2025

    @sbueringer
    Member

    @camilamacedo86 Not sure if a controller should be not ready because the metrics server is not up yet.

    For reference, we already have something for the webhook server that can be used like this: https://github.com/kubernetes-sigs/cluster-api/blob/1efdb87b22a5e4f05e8d56e473732438572b9276/main.go#L436 (see also

    func (s *DefaultServer) StartedChecker() healthz.Checker {
    )

  2. sbueringer commented on Jun 28, 2025

    @sbueringer
    Member

    But maybe it's fine to implement something similar for the metrics server so folks can ensure it actually works?

    @alvaroaleman Do you have an opinion on this?

  3. k8s-triage-robot commented on Sep 26, 2025

    @k8s-triage-robot

    The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

    This bot triages un-triaged issues according to the following rules:

    • After 90d of inactivity, lifecycle/stale is applied
    • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
    • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

    You can:

    • Mark this issue as fresh with /remove-lifecycle stale
    • Close this issue with /close
    • Offer to help out with Issue Triage

    Please send feedback to sig-contributor-experience at kubernetes/community.

    /lifecycle stale

  4. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Sep 26, 2025
  5. camilamacedo86 commented on Sep 26, 2025

    @camilamacedo86
    MemberAuthor

    /remove-lifecycle stale

  6. k8s-triage-robot commented on Oct 26, 2025

    @k8s-triage-robot

    The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

    This bot triages un-triaged issues according to the following rules:

    • After 90d of inactivity, lifecycle/stale is applied
    • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
    • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

    You can:

    • Mark this issue as fresh with /remove-lifecycle rotten
    • Close this issue with /close
    • Offer to help out with Issue Triage

    Please send feedback to sig-contributor-experience at kubernetes/community.

    /lifecycle rotten

  7. added
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Oct 26, 2025
  8. camilamacedo86 commented on Oct 26, 2025

    @camilamacedo86
    MemberAuthor

    /remove-lifecycle rotten

  9. removed
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    on Oct 26, 2025
  10. k8s-triage-robot commented on Jan 24, 2026

    @k8s-triage-robot

    The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

    This bot triages un-triaged issues according to the following rules:

    • After 90d of inactivity, lifecycle/stale is applied
    • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
    • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

    You can:

    • Mark this issue as fresh with /remove-lifecycle stale
    • Close this issue with /close
    • Offer to help out with Issue Triage

    Please send feedback to sig-contributor-experience at kubernetes/community.

    /lifecycle stale

  11. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Jan 24, 2026
  12. camilamacedo86 commented on Jan 25, 2026

    @camilamacedo86
    MemberAuthor

    /remove-lifecycle stale

  13. removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Jan 25, 2026
  14. k8s-triage-robot commented on Apr 25, 2026

    @k8s-triage-robot

    The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

    This bot triages un-triaged issues according to the following rules:

    • After 90d of inactivity, lifecycle/stale is applied
    • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
    • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

    You can:

    • Mark this issue as fresh with /remove-lifecycle stale
    • Close this issue with /close
    • Offer to help out with Issue Triage

    Please send feedback to sig-contributor-experience at kubernetes/community.

    /lifecycle stale

  15. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Apr 25, 2026
  16. camilamacedo86 commented on Apr 25, 2026

    @camilamacedo86
    MemberAuthor

    /remove-lifecycle rotten

  17. k8s-triage-robot commented on May 25, 2026

    @k8s-triage-robot

    The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

    This bot triages un-triaged issues according to the following rules:

    • After 90d of inactivity, lifecycle/stale is applied
    • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
    • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

    You can:

    • Mark this issue as fresh with /remove-lifecycle rotten
    • Close this issue with /close
    • Offer to help out with Issue Triage

    Please send feedback to sig-contributor-experience at kubernetes/community.

    /lifecycle rotten

  18. added
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on May 25, 2026
  19. camilamacedo86 commented on May 25, 2026

    @camilamacedo86
    MemberAuthor

    /remove-lifecycle stale

  20. camilamacedo86 commented on May 25, 2026

    @camilamacedo86
    MemberAuthor

    /remove-lifecycle rotten

  21. removed
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    on May 25, 2026
  22. camilamacedo86 commented on May 25, 2026

    @camilamacedo86
    MemberAuthor

    Hi @sbueringer could we please add the frozen label in this one?

  23. sbueringer commented on May 26, 2026

    @sbueringer
    Member

    /remove-lifecycle rotten
    /lifecycle frozen

  24. added
    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.
    on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions