Change:
case *corev1.Pod: // if allContainers is true, then we're going to locate all containers and then iterate through them. At that point, "allContainers" is false if !allContainers { <ins> currOpts := new(corev1.PodLogOptions) if opts != nil { opts.DeepCopyInto(currOpts) } </ins> // in case the "kubectl.kubernetes.io/default-container" annotation is present, we preset the opts.Containers to default to selected // container. This gives users ability to preselect the most interesting container in pod. <del> if annotations := t.GetAnnotations(); annotations != nil && len(opts.Container) == 0 { var containerName string </del> <ins> if annotations := t.GetAnnotations(); annotations != nil && currOpts.Container == "" { var defaultContainer string </ins> if len(annotations[podcmd.DefaultContainerAnnotationName]) > 0 { <del> containerName = annotations[podcmd.DefaultContainerAnnotationName] </del> <ins> defaultContainer = annotations[podcmd.DefaultContainerAnnotationName] </ins> } else if len(annotations[defaultLogsContainerAnnotationName]) > 0 { // Only log deprecation if we have only the old annotation. This allows users to // set both to support multiple versions of kubectl; if they are setting both // they must already know it is deprecated, so we don't need to add noisy // warnings. <del> containerName = annotations[defaultLogsContainerAnnotationName] </del> <ins> defaultContainer = annotations[defaultLogsContainerAnnotationName] </ins> fmt.Fprintf(os.Stderr, "Using deprecated annotation `kubectl.kubernetes.io/default-logs-container` in pod/%v. Please use `kubectl.kubernetes.io/default-container` insteadn", t.Name) } <del> if len(containerName) > 0 { if exists, _ := podcmd.FindContainerByName(t, containerName); exists != nil { opts.Container = containerName </del> <ins> if len(defaultContainer) > 0 { if exists, _ := podcmd.FindContainerByName(t, defaultContainer); exists == nil { fmt.Fprintf(os.Stderr, "Default container name %q not found in pod %sn", defaultContainer, t.Name) </ins> } else { <del> fmt.Fprintf(os.Stderr, "Default container name %q not found in a podn", containerName) </del> <ins> currOpts.Container = defaultContainer </ins> } } } <del> var containerName string if opts == nil || len(opts.Container) == 0 { </del> <ins> if currOpts.Container == "" { </ins> // We don't know container name. In this case we expect only one container to be present in the pod (ignoring InitContainers). // If there is more than one container, we should return an error showing all container names. if len(t.Spec.Containers) != 1 {

Discussion:
/kind bug The logs of pods with label will be output expected without errors. create the following resources: kubectl logs -l Kubernetes version (use ): latest master.
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/sig cli
I am able to pull logs from multiple containers in my test setup, this doesn't seem to be an issue with Could you check if all the containers in the specified pod are healthy?
yes, all of these pods' containers are healthy. I the section.
This is working as expected, was not able to find the default container which in both deployments you explicitly said is but only the first deployment has container, the second deployment has . /close
Closing this issue. <detailsIn response to : This is working as expected, was not able to find the default container which in both deployments you explicitly said is but only the first deployment has container, the second deployment has . /close Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details