Code change:
return err } <del> for ix := range pods.Items { pod := &pods.Items[ix] writer := setupOutputWriter(cmd, out, path.Join(namespace, pod.Name, "logs.txt")) writer.Write([]byte(fmt.Sprintf("==== START logs for %s/%s ====n", pod.Namespace, pod.Name))) request, err := f.LogsForObject(pod, &api.PodLogOptions{}, timeout) </del> <ins> printContainer := func(writer io.Writer, container api.Container, pod *api.Pod) { writer.Write([]byte(fmt.Sprintf("==== START logs for container %s of pod %s/%s ====n", container.Name, pod.Namespace, pod.Name))) defer writer.Write([]byte(fmt.Sprintf("==== END logs for container %s of pod %s/%s ====n", container.Name, pod.Namespace, pod.Name))) request, err := f.LogsForObject(pod, &api.PodLogOptions{Container: container.Name}, timeout) </ins> if err != nil { <del> return err </del> <ins> // Print error and return. writer.Write([]byte(fmt.Sprintf("Create log request error: %sn", err.Error()))) return </ins> } data, err := request.DoRaw() if err != nil { <del> return err </del> <ins> // Print error and return. writer.Write([]byte(fmt.Sprintf("Request log error: %sn", err.Error()))) return </ins> } writer.Write(data) <del> writer.Write([]byte(fmt.Sprintf("==== END logs for %s/%s ====n", pod.Namespace, pod.Name))) </del> <ins> } for ix := range pods.Items { pod := &pods.Items[ix] containers := pod.Spec.Containers writer := setupOutputWriter(cmd, out, path.Join(namespace, pod.Name, "logs.txt")) for i := range containers { printContainer(writer, containers[i], pod) } </ins> } } dir := cmdutil.GetFlagString(cmd, "output-directory")

Related discussion:
text: <!-- Thanks for filing an issue! Before hitting the button, please answer these questions.--Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see ): No What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.): cluster-info, dump, "server rejected our request for an unknown reason" Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT <!-- If this is a BUG REPORT, please: Fill in as much of the template below as you can. If you leave out information, we can't help you as well. If this is a FEATURE REQUEST, please: Describe in detail the feature/behavior/change you'd like to see. In both cases, be ready for followup questions, and please respond in a timely manner. If we can't reproduce a bug or think a feature already exists, we might close your issue. If we're wrong, PLEASE feel free to reopen it and explain why. --Kubernetes version (use ): Environment: Cloud provider or hardware configuration: AWS OS (e.g. from /etc/os-release):Kernel (e.g. ): Install tools: kubeadm Others: What happened: kubectl cluster-info dump fails to get logs from pods with multiple containers. It exits at the first such pod it encounters (in lexical order). The kube-dns pod invariable triggers this. What you expected to happen: should gracefully handle multi-container pods, fetching logs for all of containers. a dump fail, kubectl should continue dumping as much of the information from remaining resources as possible. How to reproduce it (as minimally and precisely as possible): Run with a kube-dns pod running. Anything else we need to know:
I can reproduce the error by using the latest code, let me take some investigation on this first.