Skip to content

Commit

Permalink
Specify cnsenter pod container name when fetching
Browse files Browse the repository at this point in the history
This is necessary in some setup like environement with Istio in which sidecar containers are automatically added to the pod
  • Loading branch information
jcbbc authored and ssup2 committed Jun 7, 2021
1 parent 71ffa1b commit d601e49
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cmd/kpexec/kpexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ func (o *Options) Run(args []string, argsLenAtDash int) error {
}

// Get cnsenter pod's logs
cnsLogReq := clientset.CoreV1().Pods(o.cnsPodNamespace).GetLogs(cnsPodName, &corev1.PodLogOptions{Follow: true})
cnsLogReq := clientset.CoreV1().Pods(o.cnsPodNamespace).GetLogs(cnsPodName, &corev1.PodLogOptions{Follow: true, Container: cnsContName})
cnsLog, err := cnsLogReq.Stream(context.TODO())
if err != nil {
return fmt.Errorf("failed to get cnsenter pod (%s) log stream : %+v", cnsPodName, err)
Expand Down

0 comments on commit d601e49

Please sign in to comment.