Commit 79f27737 authored by Victor Marmol's avatar Victor Marmol

Merge pull request #5120 from dchen1107/docker

monit health check kubelet and restart unhealthy one
parents b314dc60 7a47ea89
...@@ -3,4 +3,7 @@ group kubelet ...@@ -3,4 +3,7 @@ group kubelet
start program = "/etc/init.d/kubelet start" start program = "/etc/init.d/kubelet start"
stop program = "/etc/init.d/kubelet stop" stop program = "/etc/init.d/kubelet stop"
if does not exist then restart if does not exist then restart
if failed port 10250
protocol HTTP request "/healthz"
with timeout 10 seconds
then restart
...@@ -166,7 +166,7 @@ func (s *Server) handleHealthz(w http.ResponseWriter, req *http.Request) { ...@@ -166,7 +166,7 @@ func (s *Server) handleHealthz(w http.ResponseWriter, req *http.Request) {
// Check that the hostname known by the master matches the hostname // Check that the hostname known by the master matches the hostname
// the kubelet knows // the kubelet knows
hostname := s.host.GetHostname() hostname := s.host.GetHostname()
if masterHostname != hostname { if masterHostname != hostname && masterHostname != "127.0.0.1" && masterHostname != "localhost" {
s.error(w, errors.New("Kubelet hostname \""+hostname+"\" does not match the hostname expected by the master \""+masterHostname+"\"")) s.error(w, errors.New("Kubelet hostname \""+hostname+"\" does not match the hostname expected by the master \""+masterHostname+"\""))
return return
} }
......
...@@ -483,8 +483,8 @@ func TestHealthCheck(t *testing.T) { ...@@ -483,8 +483,8 @@ func TestHealthCheck(t *testing.T) {
t.Fatalf("Got error GETing: %v", err) t.Fatalf("Got error GETing: %v", err)
} }
defer resp.Body.Close() defer resp.Body.Close()
if resp.StatusCode != http.StatusInternalServerError { if resp.StatusCode != http.StatusOK {
t.Errorf("expected status code %d, got %d", http.StatusInternalServerError, resp.StatusCode) t.Errorf("expected status code %d, got %d", http.StatusOK, resp.StatusCode)
} }
//Test with old docker version //Test with old docker version
...@@ -498,7 +498,7 @@ func TestHealthCheck(t *testing.T) { ...@@ -498,7 +498,7 @@ func TestHealthCheck(t *testing.T) {
} }
defer resp.Body.Close() defer resp.Body.Close()
if resp.StatusCode != http.StatusInternalServerError { if resp.StatusCode != http.StatusInternalServerError {
t.Errorf("expected status code %d, got %d", http.StatusOK, resp.StatusCode) t.Errorf("expected status code %d, got %d", http.StatusInternalServerError, resp.StatusCode)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment