Skip to content

Commit

Permalink
Merge pull request kubernetes#2520 from mikedanese/proxy-healthz
Browse files Browse the repository at this point in the history
add health check to kube-proxy
  • Loading branch information
brendandburns committed Nov 24, 2014
2 parents 428cbcd + 5bda95f commit 4b2a5cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/kube-proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ package main
import (
"flag"
"net"
"net/http"
"strconv"
"time"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/healthz"
"github.com/GoogleCloudPlatform/kubernetes/pkg/proxy"
"github.com/GoogleCloudPlatform/kubernetes/pkg/proxy/config"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
Expand All @@ -38,6 +41,7 @@ var (
etcdConfigFile = flag.String("etcd_config", "", "The config file for the etcd client. Mutually exclusive with -etcd_servers")
bindAddress = util.IP(net.ParseIP("0.0.0.0"))
clientConfig = &client.Config{}
healthz_port = flag.Int("healthz_port", 10249, "The port to bind the health check server. Use 0 to disable.")
)

func init() {
Expand Down Expand Up @@ -100,6 +104,15 @@ func main() {
}
}

if *healthz_port > 0 {
go util.Forever(func() {
err := http.ListenAndServe(bindAddress.String()+":"+strconv.Itoa(*healthz_port), nil)
if err != nil {
glog.Errorf("Starting health server failed: %v", err)
}
}, 5*time.Second)
}

protocol := iptables.ProtocolIpv4
if net.IP(bindAddress).To4() == nil {
protocol = iptables.ProtocolIpv6
Expand Down
3 changes: 3 additions & 0 deletions pkg/master/ports/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ const (
// ControllerManagerPort is the default port for the controller manager status server.
// May be overridden by a flag at startup.
ControllerManagerPort = 10252
// ProxyPort is the default port for the proxy status server.
// May be overriden by a flag at startup.
ProxyPort = 10249
)

0 comments on commit 4b2a5cd

Please sign in to comment.