Commit 48d263d3 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #44282 from derekwaynecarr/fix-kubectl-logs

Automatic merge from submit-queue (batch tested with PRs 38751, 44282, 46382, 47603, 47606) kubectl logs with label selector supports specifying a container name **What this PR does / why we need it**: Allows `kubectl logs` to take both a label selector and container name. This allows me to fetch logs from pods by selector whose pods have multiple containers with a common name. This is a common action when debugging components like the service-catalog that ship more than one container in their pod. With this change, the following command lets me get logs for service-catalog. ``` $ kubectl logs -l app=sc-catalog-apiserver --namespace=service-catalog --container=apiserver ```
parents 9054e70c 9c956c21
......@@ -185,9 +185,6 @@ func (o *LogsOptions) Complete(f cmdutil.Factory, out io.Writer, cmd *cobra.Comm
if logOptions.Follow {
return cmdutil.UsageError(cmd, "only one of follow (-f) or selector (-l) is allowed")
}
if len(logOptions.Container) != 0 {
return cmdutil.UsageError(cmd, "a container cannot be specified when using a selector (-l)")
}
if logOptions.TailLines == nil {
logOptions.TailLines = &selectorTail
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment