diff --git a/pkg/cli/environment.go b/pkg/cli/environment.go index 60cce51a9..5c19734aa 100644 --- a/pkg/cli/environment.go +++ b/pkg/cli/environment.go @@ -275,8 +275,10 @@ func (s *EnvSettings) EnvVars() map[string]string { // Namespace gets the namespace from the configuration func (s *EnvSettings) Namespace() string { - if ns, _, err := s.config.ToRawKubeConfigLoader().Namespace(); err == nil { - return ns + if s.config != nil { + if ns, _, err := s.config.ToRawKubeConfigLoader().Namespace(); err == nil { + return ns + } } if s.namespace != "" { return s.namespace