Skip to content

Commit 6d001eb

Browse files
committed
Add logging if container or pod fails to be killed
1 parent fd74333 commit 6d001eb

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

pkg/kubelet/kubelet.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,6 +1524,8 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
15241524
if !pcm.Exists(pod) && !firstSync {
15251525
if err := kl.killPod(pod, nil, podStatus, nil); err == nil {
15261526
podKilled = true
1527+
} else {
1528+
klog.Errorf("killPod for pod %q (podStatus=%v) failed: %v", format.Pod(pod), podStatus, err)
15271529
}
15281530
}
15291531
// Create and Update pod's Cgroups

pkg/kubelet/kuberuntime/kuberuntime_container.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ func (m *kubeGenericRuntimeManager) killContainersWithSyncResult(pod *v1.Pod, ru
658658
killContainerResult := kubecontainer.NewSyncResult(kubecontainer.KillContainer, container.Name)
659659
if err := m.killContainer(pod, container.ID, container.Name, "", gracePeriodOverride); err != nil {
660660
killContainerResult.Fail(kubecontainer.ErrKillContainer, err.Error())
661+
klog.Errorf("killContainer %q(id=%q) for pod %q failed: %v", container.Name, container.ID, format.Pod(pod), err)
661662
}
662663
containerResults <- killContainerResult
663664
}(container)

0 commit comments

Comments
 (0)