k3s-io / k3s

Lightweight Kubernetes
https://k3s.io
Apache License 2.0
26.62k stars 2.24k forks source link

Enable serving supervisor metrics #10019

Open brandond opened 3 weeks ago

brandond commented 3 weeks ago

Proposed Changes

This is required to expose supervisor metrics on rke2; on k3s the metrics will be the same as those currently available from kubelet and apiserver metrics endpoints

Types of Changes

enhancement

Verification

metrics:

  1. Start servers with --supervisor-metrics
  2. curl -vks --cert /var/lib/rancher/k3s/server/tls/client-admin.crt --key /var/lib/rancher/k3s/server/tls/client-admin.key https://node:6443/metrics against agents and servers

pprof:

  1. Start node (agent or server) with --enable-pprof
  2. curl -vks --cert /var/lib/rancher/k3s/server/tls/client-admin.crt --key /var/lib/rancher/k3s/server/tls/client-admin.key https://node:6443/debug/pprof/ against node with pprof enabled

Testing

Linked Issues

User-Facing Change

`--enable-pprof` can now be set on agents to enable the debug/pprof endpoints. When set, agents will listen on the supervisor port.
`--supervisor-metrics` can now be set on servers to enable serving internal metrics on the supervisor endpoint; when set agents will listen on the supervisor port.

Further Comments

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 24.09091% with 167 lines in your changes are missing coverage. Please review.

Project coverage is 41.70%. Comparing base (dba30ab) to head (bcdd0be).

Files Patch % Lines
pkg/agent/https/https.go 0.00% 52 Missing :warning:
pkg/util/net.go 14.81% 45 Missing and 1 partial :warning:
pkg/profile/profile.go 0.00% 13 Missing :warning:
pkg/metrics/metrics.go 0.00% 9 Missing :warning:
pkg/agent/run.go 0.00% 4 Missing and 2 partials :warning:
pkg/cli/agent/agent.go 40.00% 3 Missing and 3 partials :warning:
pkg/cli/server/server.go 66.66% 3 Missing and 3 partials :warning:
pkg/spegel/spegel.go 0.00% 6 Missing :warning:
pkg/agent/config/config.go 58.33% 2 Missing and 3 partials :warning:
pkg/server/router.go 50.00% 5 Missing :warning:
... and 7 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #10019 +/- ## ========================================== - Coverage 46.55% 41.70% -4.85% ========================================== Files 173 177 +4 Lines 14645 14740 +95 ========================================== - Hits 6818 6148 -670 - Misses 6540 7425 +885 + Partials 1287 1167 -120 ``` | [Flag](https://app.codecov.io/gh/k3s-io/k3s/pull/10019/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=k3s-io) | Coverage Δ | | |---|---|---| | [e2etests](https://app.codecov.io/gh/k3s-io/k3s/pull/10019/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=k3s-io) | `36.38% <24.09%> (-10.00%)` | :arrow_down: | | [inttests](https://app.codecov.io/gh/k3s-io/k3s/pull/10019/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=k3s-io) | `37.05% <20.90%> (?)` | | | [unittests](https://app.codecov.io/gh/k3s-io/k3s/pull/10019/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=k3s-io) | `11.31% <0.90%> (-0.08%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=k3s-io#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.