diff --git a/pkg/antctl/client.go b/pkg/antctl/client.go index c042d433734..fb158ea3301 100644 --- a/pkg/antctl/client.go +++ b/pkg/antctl/client.go @@ -58,7 +58,9 @@ func (c *client) resolveKubeconfig(opt *requestOption) (*rest.Config, error) { var kubeconfig *rest.Config if _, err = os.Stat(opt.kubeconfig); opt.kubeconfig == clientcmd.RecommendedHomeFile && os.IsNotExist(err) { kubeconfig, err = rest.InClusterConfig() - err = nil + if err != nil { + err = fmt.Errorf("Unable to resolve in-cluster configuration: %v. Please specify the kubeconfig file", err) + } } else { kubeconfig, err = clientcmd.BuildConfigFromFlags("", opt.kubeconfig) }