Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
79f27737
Commit
79f27737
authored
Mar 05, 2015
by
Victor Marmol
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5120 from dchen1107/docker
monit health check kubelet and restart unhealthy one
parents
b314dc60
7a47ea89
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
kubelet
cluster/saltbase/salt/monit/kubelet
+4
-1
server.go
pkg/kubelet/server.go
+1
-1
server_test.go
pkg/kubelet/server_test.go
+3
-3
No files found.
cluster/saltbase/salt/monit/kubelet
View file @
79f27737
...
...
@@ -3,4 +3,7 @@ group kubelet
start program = "/etc/init.d/kubelet start"
stop program = "/etc/init.d/kubelet stop"
if does not exist then restart
if failed port 10250
protocol HTTP request "/healthz"
with timeout 10 seconds
then restart
pkg/kubelet/server.go
View file @
79f27737
...
...
@@ -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
// the kubelet knows
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
+
"
\"
"
))
return
}
...
...
pkg/kubelet/server_test.go
View file @
79f27737
...
...
@@ -483,8 +483,8 @@ func TestHealthCheck(t *testing.T) {
t
.
Fatalf
(
"Got error GETing: %v"
,
err
)
}
defer
resp
.
Body
.
Close
()
if
resp
.
StatusCode
!=
http
.
Status
InternalServerError
{
t
.
Errorf
(
"expected status code %d, got %d"
,
http
.
Status
InternalServerError
,
resp
.
StatusCode
)
if
resp
.
StatusCode
!=
http
.
Status
OK
{
t
.
Errorf
(
"expected status code %d, got %d"
,
http
.
Status
OK
,
resp
.
StatusCode
)
}
//Test with old docker version
...
...
@@ -498,7 +498,7 @@ func TestHealthCheck(t *testing.T) {
}
defer
resp
.
Body
.
Close
()
if
resp
.
StatusCode
!=
http
.
StatusInternalServerError
{
t
.
Errorf
(
"expected status code %d, got %d"
,
http
.
Status
OK
,
resp
.
StatusCode
)
t
.
Errorf
(
"expected status code %d, got %d"
,
http
.
Status
InternalServerError
,
resp
.
StatusCode
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment