mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Export Prometheus metrics in kube-proxy
This commit is contained in:
parent
6ba69ed9a1
commit
179cef3ca3
@ -35,6 +35,7 @@ go_library(
|
|||||||
"//pkg/util/resourcecontainer:go_default_library",
|
"//pkg/util/resourcecontainer:go_default_library",
|
||||||
"//pkg/util/sysctl:go_default_library",
|
"//pkg/util/sysctl:go_default_library",
|
||||||
"//vendor:github.com/golang/glog",
|
"//vendor:github.com/golang/glog",
|
||||||
|
"//vendor:github.com/prometheus/client_golang/prometheus",
|
||||||
"//vendor:github.com/spf13/cobra",
|
"//vendor:github.com/spf13/cobra",
|
||||||
"//vendor:github.com/spf13/pflag",
|
"//vendor:github.com/spf13/pflag",
|
||||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||||
|
@ -57,6 +57,7 @@ import (
|
|||||||
utilsysctl "k8s.io/kubernetes/pkg/util/sysctl"
|
utilsysctl "k8s.io/kubernetes/pkg/util/sysctl"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
@ -342,6 +343,7 @@ func (s *ProxyServer) Run() error {
|
|||||||
http.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintf(w, "%s", s.ProxyMode)
|
fmt.Fprintf(w, "%s", s.ProxyMode)
|
||||||
})
|
})
|
||||||
|
http.Handle("/metrics", prometheus.Handler())
|
||||||
configz.InstallHandler(http.DefaultServeMux)
|
configz.InstallHandler(http.DefaultServeMux)
|
||||||
go wait.Until(func() {
|
go wait.Until(func() {
|
||||||
err := http.ListenAndServe(s.Config.HealthzBindAddress+":"+strconv.Itoa(int(s.Config.HealthzPort)), nil)
|
err := http.ListenAndServe(s.Config.HealthzBindAddress+":"+strconv.Itoa(int(s.Config.HealthzPort)), nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user