eldadru / ksniff

Kubectl plugin to ease sniffing on kubernetes pods using tcpdump and wireshark
Apache License 2.0
3.18k stars 190 forks source link

Context was not found for specified context #110

Closed CezarManea closed 2 years ago

CezarManea commented 3 years ago

Latest version of ksniff (v1.6.0) does not work with KUBECONFIG environment variable that was multiple config files. All works of with a single config file or the first config file in the list.
kubectl works ok and also kubectl config view looks ok.

➜ kubectl sniff demo -n default
Error: invalid configuration: [context was not found for specified context: minikube, cluster has no server defined]
bostrt commented 3 years ago

Hi @CezarManea,

Thanks for reporting this issue. I see the same thing on my side. We'll have to rework how the kubeconfig is loaded to address this. I'll submit a PR and it should be included in next release of ksniff.

mrszop commented 3 years ago

Hey,

is this issue still open? I'm getting the same message after todays installation:

~/Doc/c/bab/15/szop/elasticsearch on elasticsearch ❯ kubectl krew info sniff
NAME: sniff
INDEX: default
URI: https://github.com/eldadru/ksniff/releases/download/v1.6.0/ksniff.zip
SHA256: 513b04c6a63a287e9566c28a9d72fdd8d06c6aa0ab8eb30e5303923c97701ab8
VERSION: v1.6.0
HOMEPAGE: https://github.com/eldadru/ksniff
DESCRIPTION: 
When working with micro-services, many times it's very helpful to get a capture of the network
activity between your micro-service and it's dependencies.

ksniff use kubectl to upload a statically compiled tcpdump binary to your pod and redirecting it's
output to your local Wireshark for smooth network debugging experience.

CAVEATS:
\
 | This plugin needs the following programs:
 | * wireshark (optional, used for live capture)
/
/Users/szop/.krew/bin/kubectl-sniff elasticsearch-master-0 -n elasticsearch

Error: invalid configuration: [context was not found for specified context: admin@szop/staging, cluster has no server defined]

Cheers

shibumi commented 3 years ago

Hi, I get the same error .. looks like this is still open :(

wd commented 2 years ago

a workaround for this is to run the command like this KUBECONFIG=path/to/the/file kubectl sniff xx

bcouetil commented 10 months ago

I just experienced the problem too, and was searching for a fix. Thank you for the workaround !