kubeswitch icon indicating copy to clipboard operation
kubeswitch copied to clipboard

Switch ns throws error stating kubeconfig file doesn't exist

Open KesavanKing opened this issue 2 years ago • 4 comments

I tried this wonderful tool. This has become everyday handy tool to switch between clusters/kubeconfigs.

But switching ns doesn't work properly

switch ns
Error: unable to list namespaces. The kubeconfig file "" does not exist
unable to list namespaces. The kubeconfig file "" does not exist%

KesavanKing avatar Jan 21 '22 10:01 KesavanKing

Im facing the same issue

conblem avatar Mar 08 '22 07:03 conblem

Sorry for the delay. Could you check if the fix included in this commit works for you?

You can use the from source installation method described here. Thanks a lot!

danielfoehrKn avatar Mar 31 '22 10:03 danielfoehrKn

Still I get the same issue.

Always it expects this /Users/username/.kube/config to be present. Then it works correctly.

If I delete the /Users/username/.kube/config file it get this error

KesavanKing avatar Mar 31 '22 10:03 KesavanKing

Assuming no switch-config file.

KUBECONFIG env set to valid kubeconfig + /Users/username/.kube/config not present --> switch ns works

KUBECONFIG env not set + /Users/username/.kube/config not present --> does throw the above error.

  • switch throws: Error: you need to point kubeswitch to a kubeconfig file
  • switch ns throws Error: unable to list namespaces.

Can you check if you have a KUBECONFIG env variable set if the file /Users/username/.kube/config is not present?

danielfoehrKn avatar Mar 31 '22 11:03 danielfoehrKn