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

Invalid configuration error due to context not found #150

Open
juan-vg opened this issue Jul 25, 2022 · 4 comments
Open

Invalid configuration error due to context not found #150

juan-vg opened this issue Jul 25, 2022 · 4 comments
Assignees

Comments

@juan-vg
Copy link

juan-vg commented Jul 25, 2022

Problem

When using several kubeconfigs referenced by the KUBECONFIG env var (colon separated paths), this plugin doesn't work. Not even when referencing the specific config file.

$ echo $KUBECONFIG
/home/me/.kube/config:/home/me/.kube/config2:/home/me/.kube/config3

$ kubectl get pods
NAME    READY    STATUS    RESTARTS    AGE
mypod   1/1      Running   0           5d3h

$ kubectl sniff mypod
Error: invalid configuration: [context was not found for specified context: mycluster, cluster has no server defined]

$ kubectl sniff -x /home/me/.kube/config2 mypod
Error: context doesn't exist

Workaround

I managed to make it work by doing the following steps

  1. Unset the KUBECONFIG var
  2. Remove the main config file (~/.kube/config)
  3. Copy the contents of the desired config file to the main one (~/.kube/config)
@juan-vg
Copy link
Author

juan-vg commented Jul 25, 2022

As far as I understand the -x flag is intended to specify a context name, not a kubeconfig file (which is what I tried). Just mention I've also tried to specify the context name using that flag and the result is the same.

The problem looks to come from the fact I'm using several kubeconfigs at the same time, which should not be an issue.

@bostrt
Copy link
Collaborator

bostrt commented Jul 26, 2022

I think 80a5e9f resolves this issue. Would you mind building from the master branch to see if it indeed helps?

@bostrt bostrt self-assigned this Jul 26, 2022
@juan-vg
Copy link
Author

juan-vg commented Jul 27, 2022

Oh, my bad. This looks like a duplicate of #110. I will check it ASAP and come back with feedback. Thank you @bostrt

@Noksa
Copy link

Noksa commented Mar 9, 2023

Still the issue in 1.6.2 if KUBECONFIG var contains more 1 cluster

❯ ~ k sniff -n kazoo5-frankfurt ecallmgr-56d8bc767d-ngzpk -c apps --image nicolaka/netshoot -p -f "tcp port 5984"
Error: invalid configuration: [context was not found for specified context: kubernetes-admin-k8s-frankfurt@k8s-frankfurt, cluster has no server defined]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants