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

Failed to load kubernetes config: invalid configuration: no configuration has been provided #35

Closed
sundowndev opened this issue Aug 27, 2021 · 11 comments
Labels
question Further information is requested

Comments

@sundowndev
Copy link

I'm stuck with this error Failed to load kubernetes config: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable. Setting the env var KUBERNETES_MASTER or KUBE_CONFIG_PATH does not change anything, what am I missing ?

@dwertent
Copy link
Contributor

@sundowndev I'm not sure what you are missing, is it possible you do not have a running Kubernetes cluster?

We use the client-go package for loading the Kubernetes config.

Please update if you managed to solve your issue

@dwertent dwertent added the question Further information is requested label Aug 29, 2021
@sundowndev
Copy link
Author

sundowndev commented Aug 31, 2021

@dwertent Not sure what I should specify in KUBERNETES_MASTER for it to work, I tried my kubeconfig path, my cluster's URL...

is it possible you do not have a running Kubernetes cluster?

No, I can manage my cluster with kubectl.

I think a better documentation about requirements and configuration would help me

@slashben
Copy link
Contributor

@sundowndev , if you don't mind, can you please share how your Kubernetes cluster is hosted? (minikube, EKS, GKE or etc.)

I am asking because for GKE support we needed to include an additional go module

@sundowndev
Copy link
Author

@BenHirschbergCa It's hosted on Digitalocean

@hermanbanken
Copy link

I have the same error, but I'm using plain YAML generated via Kustomize, eg.

cat output.dev.yaml        | kubescape scan framework nsa -
cat output.test.yaml       | kubescape scan framework nsa -

@dwertent
Copy link
Contributor

dwertent commented Sep 1, 2021

@hermanbanken I think the issue in your case is that Kubescape loads the k8s config when the input is a file, loading the config is unnecessary since the input is a file and not a running cluster.

We will fix this next release :)

@hermanbanken
Copy link

hermanbanken commented Sep 1, 2021

@hermanbanken I think the issue in your case is that Kubescape loads the k8s config when the input is a file, loading the config is unnecessary since the input is a file and not a running cluster.
We will fix this next release :)

Cool! I was looking at the policyhandler package and couldn't figure out why it wasn't loading instead of getting the resources
https://github.com/armosec/kubescape/blob/571a15bee8de5a75beaee1aad091fcde2d7c25ca/policyhandler/handlenotification.go#L79-L84

Turned out it was aborting way before 😄

@dwertent
Copy link
Contributor

dwertent commented Sep 1, 2021

@hermanbanken I fixed the issue, please confirm it works :)

@dwertent
Copy link
Contributor

dwertent commented Sep 1, 2021

@sundowndev try setting export KUBECONFIG=<path to config>, is it better?

@sundowndev
Copy link
Author

@sundowndev try setting export KUBECONFIG=<path to config>, is it better?

yep that's it, I confused KUBE_CONFIG_PATH and KUBECONFIG, thanks

@hermanbanken
Copy link

Verified it works, thanks!

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

No branches or pull requests

4 participants