diff --git a/pkg/cmd/proxy/kubectl/cmd.go b/pkg/cmd/proxy/kubectl/cmd.go index c186db6d3..ecf71aea8 100644 --- a/pkg/cmd/proxy/kubectl/cmd.go +++ b/pkg/cmd/proxy/kubectl/cmd.go @@ -124,10 +124,8 @@ func NewCmd(clusteradmFlags *genericclioptionsclusteradm.ClusteradmFlags, stream klog.V(4).Infof("kubeconfig file path is %s", tmpKubeconfigFilePath) // Using kubectl to access the managed cluster using the above customized kubeconfig - result, err := runKubectlCommmand(tmpKubeconfigFilePath, o.kubectlArgs) - if err != nil { - return errors.Wrap(err, "run kubectl commands failed") - } + // We are using combinedoutput, so err msg should include in result, no need to handle err + result, _ := runKubectlCommmand(tmpKubeconfigFilePath, o.kubectlArgs) if _, err = streams.Out.Write(result); err != nil { return errors.Wrap(err, "streams out write failed") } diff --git a/pkg/cmd/proxy/kubectl/http-proxy-server.go b/pkg/cmd/proxy/kubectl/http-proxy-server.go index e039303ef..7eb8c66a4 100644 --- a/pkg/cmd/proxy/kubectl/http-proxy-server.go +++ b/pkg/cmd/proxy/kubectl/http-proxy-server.go @@ -117,7 +117,7 @@ func (s *httpProxyServer) handle(wr http.ResponseWriter, req *http.Request) { if proxyConn != nil { err = proxyConn.Close() if err != nil { - klog.Errorf("connection closed: %v", err) + klog.V(4).ErrorS(err, "connection closed") } } }()