From e4f739115f7378d2642bc63e2599732028618eea Mon Sep 17 00:00:00 2001 From: Yu-Ju Hong Date: Fri, 23 Oct 2015 14:31:40 -0700 Subject: [PATCH] kubelet: fix getting logs from static pods This change adds the necessary UID translation logic to fix the issue. --- pkg/kubelet/kubelet.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 675495c38ce..dbcdf2478d0 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -2211,7 +2211,11 @@ func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName string, lo return fmt.Errorf("unable to get logs for container %q in pod %q namespace %q: unable to find pod", containerName, name, namespace) } - podStatus, found := kl.statusManager.GetPodStatus(pod.UID) + podUID := pod.UID + if mirrorPod, ok := kl.podManager.GetMirrorPodByPod(pod); ok { + podUID = mirrorPod.UID + } + podStatus, found := kl.statusManager.GetPodStatus(podUID) if !found { return fmt.Errorf("failed to get status for pod %q in namespace %q", name, namespace) }