Skip to content

Commit

Permalink
add statusz for kubelet
Browse files Browse the repository at this point in the history
  • Loading branch information
zhifei92 committed Dec 10, 2024
1 parent a499fac commit a04df83
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/kubelet/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ import (
metricsfeatures "k8s.io/component-base/metrics/features"
"k8s.io/component-base/metrics/legacyregistry"
"k8s.io/component-base/metrics/prometheus/slis"
zpagesfeatures "k8s.io/component-base/zpages/features"
"k8s.io/component-base/zpages/statusz"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
"k8s.io/cri-client/pkg/util"
podresourcesapi "k8s.io/kubelet/pkg/apis/podresources/v1"
Expand Down Expand Up @@ -105,6 +107,8 @@ const (
debugFlagPath = "/debug/flags/v"
podsPath = "/pods"
runningPodsPath = "/runningpods/"

kubeletComponent = "kubelet"
)

// Server is a http.Handler which exposes kubelet functionality over HTTP.
Expand Down Expand Up @@ -406,6 +410,10 @@ func (s *Server) InstallDefaultHandlers() {
checkers = append(checkers, s.extendedCheckers...)
healthz.InstallHandler(s.restfulCont, checkers...)

if utilfeature.DefaultFeatureGate.Enabled(zpagesfeatures.ComponentStatusz) {
statusz.Install(s.restfulCont, kubeletComponent, statusz.NewRegistry())
}

slis.SLIMetricsWithReset{}.Install(s.restfulCont)

s.addMetricsBucketMatcher("pods")
Expand Down

0 comments on commit a04df83

Please sign in to comment.