Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic on run without current context #2458

Closed
markwellis opened this issue Jan 10, 2024 · 2 comments
Closed

panic on run without current context #2458

markwellis opened this issue Jan 10, 2024 · 2 comments
Labels
bug Something isn't working InProgress Marks an issue has being worked on

Comments

@markwellis
Copy link

markwellis commented Jan 10, 2024




Describe the bug
When I launch k9s it panics

panic: unable to activate context "": getcontext - invalid context specified: ""

goroutine 1 [running]:
github.com/derailed/k9s/cmd.Execute(...)
	/builddir/build/BUILD/k9s-0.31.2/cmd/root.go:60
main.main()
	/builddir/build/BUILD/k9s-0.31.2/main.go:32 +0x3c

This is because I have 7 kubernetes contexts defined, and no current context configured.

$ kubectl config view | grep "current"
current-context: ""

I always pass --context to kubectl. k9s used to open on the contexts page and I could select which one from there. Something has changed since version 0.29 which is the previous version I had installed that worked fine with this setup.

To Reproduce
Steps to reproduce the behavior:

  1. unset the current kubectl context, kubectl config unset current-context
  2. run k9s
  3. see error
  4. set kubectl current context, kubectl config use-context $context_name
  5. run k9s
  6. works

Expected behavior
If no current context is set, then open on the contexts page

Versions (please complete the following information):

  • OS: Linux, Fedora 39
  • K9s: v0.31.2
  • K8s: v1.27.9
@markwellis markwellis changed the title panic on run - panic: unable to activate context panic on run without current context Jan 10, 2024
@derailed derailed added bug Something isn't working InProgress Marks an issue has being worked on labels Jan 10, 2024
derailed added a commit that referenced this issue Jan 10, 2024
derailed added a commit that referenced this issue Jan 10, 2024
* allow k9s to run with errors

* fixes #2459 #2458 #2454 #2435

* v0.31.3 rel notes
@derailed
Copy link
Owner

derailed commented Jan 10, 2024

@markwellis Thank you for the report! Fixed v0.31.3

@markwellis
Copy link
Author

Wow that was fast! Awesome work, thanks very much :)

thejoeejoee pushed a commit to thejoeejoee/k9s that referenced this issue Feb 23, 2024
* allow k9s to run with errors

* fixes derailed#2459 derailed#2458 derailed#2454 derailed#2435

* v0.31.3 rel notes
placintaalexandru pushed a commit to placintaalexandru/k9s that referenced this issue Apr 3, 2024
* allow k9s to run with errors

* fixes derailed#2459 derailed#2458 derailed#2454 derailed#2435

* v0.31.3 rel notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working InProgress Marks an issue has being worked on
Projects
None yet
Development

No branches or pull requests

2 participants