Merge pull request #42104 from piosz/kube-proxy-metrics

Automatic merge from submit-queue (batch tested with PRs 41116, 41804, 42104, 42111, 42120)

Export Prometheus metrics in kube-proxy

Some metrics are already collected inside of kube-proxy (see https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-proxy/proxy.go#L28). This exposes `/metrics` endpoint on healtz port.

ref #40736 #9125

cc @brancz @fabxc
This commit is contained in:
Kubernetes Submit Queue 2017-02-27 04:10:26 -08:00 committed by GitHub
commit 080a931935
2 changed files with 3 additions and 0 deletions

View File

@ -35,6 +35,7 @@ go_library(
"//pkg/util/resourcecontainer:go_default_library",
"//pkg/util/sysctl:go_default_library",
"//vendor:github.com/golang/glog",
"//vendor:github.com/prometheus/client_golang/prometheus",
"//vendor:github.com/spf13/cobra",
"//vendor:github.com/spf13/pflag",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",

View File

@ -57,6 +57,7 @@ import (
utilsysctl "k8s.io/kubernetes/pkg/util/sysctl"
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@ -342,6 +343,7 @@ func (s *ProxyServer) Run() error {
http.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "%s", s.ProxyMode)
})
http.Handle("/metrics", prometheus.Handler())
configz.InstallHandler(http.DefaultServeMux)
go wait.Until(func() {
err := http.ListenAndServe(s.Config.HealthzBindAddress+":"+strconv.Itoa(int(s.Config.HealthzPort)), nil)