Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Minikube with Env KUBECONFIG (different filename) fails to load (no default context) #354

Open
styk-tv opened this issue Apr 28, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@styk-tv
Copy link

styk-tv commented Apr 28, 2020

Normally this is not an issue. Everything defaults to ./kube/config and works fine. But what if your configfile is under a different filename? You would set KUBECONFIG environment variable to something like ".kube/config.mini" and kubectl works fine.

However, by default minikube has no default context set. Kubectl is able to deal with this fine, however pykube insist default config to be set.

Minikube produces:

current-context: ""

from piggybacking.py
Screenshot 2020-04-28 at 13 25 56

results with
Screenshot 2020-04-28 at 13 26 38

Maybe this is not an issue of kopf but pykube but I couldn't find the fork. If config file has no default current-context set and if there is only one context in the config file, default behaviour should be to load that context yes?

so this is when using

@kopf.on.login()
def login_fn(**kwargs):
    return kopf.login_via_pykube(**kwargs)

when using just default login, the KUBECONFIG variable is NOT considered at all, i don't really care for pykube much if i could just specify a custom filename for KUBECONFIG

This can be easily fixed by just setting default context right, but fix should live in the code i guess is my point.

I hope this can be useful to someone.

Cheers.

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

No branches or pull requests

1 participant