diff --git a/pkg/k8s/k8s.go b/pkg/k8s/k8s.go index 966ff98..07cb8f3 100644 --- a/pkg/k8s/k8s.go +++ b/pkg/k8s/k8s.go @@ -579,7 +579,12 @@ func (c *cluster) ClusterNameVersion() (string, string, error) { } clusterName := "k8s.io/kubernetes" if len(rawCfg.Contexts) > 0 { - clusterName = rawCfg.Contexts[rawCfg.CurrentContext].Cluster + if c.currentContext != "" { + rawCfg.CurrentContext = c.currentContext + } + if clusterContext, ok := rawCfg.Contexts[rawCfg.CurrentContext]; ok { + clusterName = clusterContext.Cluster + } } version, err := c.clientset.ServerVersion() if err != nil {