-
Notifications
You must be signed in to change notification settings - Fork 777
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
microk8s.kubectl does not respect $KUBECONFIG
var
#259
Comments
Hi @nicja Thank you for opening this issue. The problem we are facing is because the kubectl wrapper has the path to kubeconfig file hard coded https://github.com/ubuntu/microk8s/blob/master/microk8s-resources/wrappers/microk8s-kubectl.wrapper#L9 . Instead we should have an arguments file under https://github.com/ubuntu/microk8s/tree/master/microk8s-resources/default-args and have the kubectl wrapper append any arguments to the command. This is aligned with what we do for the rest of the MicroK8s daemons and would allow users to define their own location of the kubeconfig file. If no location is set kubectl should use the |
Assuming the wrapper would have access to $KUBECONFIG, the following might work for kubectl.wrapper: ${SNAP}/kubectl --kubeconfig="${KUBECONFIG:-${SNAP}/client.config}" "$@" --- edited to add quotes to handle paths with spaces in $KUBECONFIG |
Hi all, @losinggeneration But I was able to use a custom kubeconfig the following way (beware: it's a very dirty workaround with room for improvement, but I thought I'd share it anyway):
Now I am able to write to the config.
Regards, --- Update: Corrected a syntax mistake in a shell command. |
Any update on this? Or is there any quick workaround? @marcbrandner suggested answer did not work for me. |
It is now possible to work around this in the latest snap version (1.14.1) by editing
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I know from #180 that currently we cannot edit the default config file used by microk8s.kubectl, however the output of
microk8s.kubectl config -h
says that:This is not happening however. Even when this env var is set, microk8s.kubectl is still referring to
/snap/microk8s/current/client.config
It would be great if we could specify this in an ENV var as I work with a lot of existing CI scripts where it would not be feasible to add
--kubeconfig /xxx/xxx/config
to each. It would be great to be able to set this in a config var in lieu of being able to edit the default config fileThe text was updated successfully, but these errors were encountered: