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
eb831919
Commit
eb831919
authored
Jan 05, 2015
by
saadali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve kubelet logging around container being killed due to hash change
parent
4f8b821c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
kubelet.go
pkg/kubelet/kubelet.go
+5
-4
No files found.
pkg/kubelet/kubelet.go
View file @
eb831919
...
@@ -672,7 +672,7 @@ func (kl *Kubelet) killContainer(dockerContainer *docker.APIContainers) error {
...
@@ -672,7 +672,7 @@ func (kl *Kubelet) killContainer(dockerContainer *docker.APIContainers) error {
}
}
func
(
kl
*
Kubelet
)
killContainerByID
(
ID
,
name
string
)
error
{
func
(
kl
*
Kubelet
)
killContainerByID
(
ID
,
name
string
)
error
{
glog
.
V
(
2
)
.
Infof
(
"Killing
: %s"
,
ID
)
glog
.
V
(
2
)
.
Infof
(
"Killing
container with id %s and name %s"
,
ID
,
name
)
err
:=
kl
.
dockerClient
.
StopContainer
(
ID
,
10
)
err
:=
kl
.
dockerClient
.
StopContainer
(
ID
,
10
)
if
len
(
name
)
==
0
{
if
len
(
name
)
==
0
{
return
err
return
err
...
@@ -783,13 +783,14 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
...
@@ -783,13 +783,14 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
uuid
:=
pod
.
UID
uuid
:=
pod
.
UID
containersToKeep
:=
make
(
map
[
dockertools
.
DockerID
]
empty
)
containersToKeep
:=
make
(
map
[
dockertools
.
DockerID
]
empty
)
killedContainers
:=
make
(
map
[
dockertools
.
DockerID
]
empty
)
killedContainers
:=
make
(
map
[
dockertools
.
DockerID
]
empty
)
glog
.
V
(
4
)
.
Infof
(
"Syncing Pod, podFullName: %s, uuid: %s"
,
podFullName
,
uuid
)
// Make sure we have a network container
// Make sure we have a network container
var
netID
dockertools
.
DockerID
var
netID
dockertools
.
DockerID
if
netDockerContainer
,
found
,
_
:=
dockerContainers
.
FindPodContainer
(
podFullName
,
uuid
,
networkContainerName
);
found
{
if
netDockerContainer
,
found
,
_
:=
dockerContainers
.
FindPodContainer
(
podFullName
,
uuid
,
networkContainerName
);
found
{
netID
=
dockertools
.
DockerID
(
netDockerContainer
.
ID
)
netID
=
dockertools
.
DockerID
(
netDockerContainer
.
ID
)
}
else
{
}
else
{
glog
.
V
(
3
)
.
Infof
(
"Network container doesn't exist for pod %q,
re-creating the pod"
,
podFullName
)
glog
.
V
(
2
)
.
Infof
(
"Network container doesn't exist for pod %q, killing and
re-creating the pod"
,
podFullName
)
count
,
err
:=
kl
.
killContainersInPod
(
pod
,
dockerContainers
)
count
,
err
:=
kl
.
killContainersInPod
(
pod
,
dockerContainers
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -845,9 +846,9 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
...
@@ -845,9 +846,9 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
containersToKeep
[
containerID
]
=
empty
{}
containersToKeep
[
containerID
]
=
empty
{}
continue
continue
}
}
glog
.
V
(
1
)
.
Infof
(
"pod %s container %s is unhealthy."
,
podFullName
,
container
.
Name
,
healthy
)
glog
.
V
(
1
)
.
Infof
(
"pod %s container %s is unhealthy.
Container will be killed and re-created.
"
,
podFullName
,
container
.
Name
,
healthy
)
}
else
{
}
else
{
glog
.
V
(
3
)
.
Infof
(
"container hash changed %d vs %d."
,
hash
,
expectedHash
)
glog
.
V
(
1
)
.
Infof
(
"pod %s container %s hash changed (%d vs %d). Container will be killed and re-created."
,
podFullName
,
container
.
Name
,
hash
,
expectedHash
)
}
}
if
err
:=
kl
.
killContainer
(
dockerContainer
);
err
!=
nil
{
if
err
:=
kl
.
killContainer
(
dockerContainer
);
err
!=
nil
{
glog
.
V
(
1
)
.
Infof
(
"Failed to kill container %s: %v"
,
dockerContainer
.
ID
,
err
)
glog
.
V
(
1
)
.
Infof
(
"Failed to kill container %s: %v"
,
dockerContainer
.
ID
,
err
)
...
...
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