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

"list access denied" when switching contexts within k9s since 0.32.0 #2592

Closed
tibeer opened this issue Mar 5, 2024 · 6 comments
Closed

"list access denied" when switching contexts within k9s since 0.32.0 #2592

tibeer opened this issue Mar 5, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@tibeer
Copy link

tibeer commented Mar 5, 2024




Describe the bug
Switching between multiple kube contexts that belong to the same cluster trows an error since 0.32.0

To Reproduce
Steps to reproduce the behavior:

  1. Create two kube config files that contain each one context for the same cluster but for different namespaces (e.g. context_one: namespace a, context_two: namespace b)
  2. export the environment variable like this: export KUBECONFIG=/Users/foo/.kube/context_one.yaml:/Users/foo/.kube/context_two.yaml
  3. select with kubectl config use-context context_one
  4. start k9s and view some resources of context_one
  5. use ctxinside k9s to switch contexts
  6. try to view resources
  7. see the error
Bildschirmfoto 2024-03-05 um 05 22 33

Historical Documents
N/A

Expected behavior
Context switchting from within k9s is possible without any errors

Screenshots
see above

Versions (please complete the following information):

  • OS: OSX
  • K9s: 0.32.0
  • K8s: 1.20 (customers are scared of updates :)

Additional context
N/A

@lennan-norlys
Copy link

I see almost the same issue after updating to k9s 0.32.0, and the same behavior on 0.32.1

In my use case, I have multiple contexts for different clusters, but the namespace is namespace_a in every context.

I'm able to switch contexts using kubectl config use-context xyz, making me confident about this being an issue relating to k9s.

I noticed the error code indicating that k9s is trying to use default namespace, which makes this "expected behavior" because my user is limited to a single namespace.
This makes me think k9s cant use/read the namespace from kubeconfig when switching context thus resorting to default.

These are my observations. Unfortunately, I'm not familiar with the k9s code base, so I really don't have any suggestions for a solution.

@derailed
Copy link
Owner

derailed commented Mar 5, 2024

@lennan-norlys Thank you for the additional details!
Could you post your logs k9s -l trace. So we can fish this out?

[@tibeer] what does this yield: k auth can-i list pods -n default --context ctxXXX using the context from your repro

@tibeer
Copy link
Author

tibeer commented Mar 6, 2024

As expected: "no" 😄
But as far as I am aware, we do not even have the default namespace any more. I guess it was deleted right after cluster creation, but I do not have insight into this info.

@lennan-norlys
Copy link

@derailed This should be the file you're asking for.
k9s.log

@derailed derailed added the bug Something isn't working label Mar 16, 2024
derailed added a commit that referenced this issue Mar 20, 2024
derailed added a commit that referenced this issue Mar 20, 2024
* [Bug] fix #2605

* [Bug] fix #2604

* [Bug] fix #2592

* [Bug] fix #2608

* [Bug] Fix #2612

* Rel v0.32.4
@tibeer
Copy link
Author

tibeer commented Mar 21, 2024

Awesome! Thanks a lot 🚀

@lennan-norlys
Copy link

The latest release solved my issue. Thanks alot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants