microk8s.kubectl does not respect `$KUBECONFIG` var
See original GitHub issueI know from https://github.com/ubuntu/microk8s/issues/180 that currently we cannot edit the default config file used by microk8s.kubectl, however the output of microk8s.kubectl config -h
says that:
2. If $KUBECONFIG environment variable is set, then it is used as a list of paths (normal path delimitting rules for
your system). These paths are merged. When a value is modified, it is modified in the file that defines the stanza. When
a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the
last file in the list.
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 file
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
microk8s.kubectl does not respect $KUBECONFIG var #259
The problem we are facing is because the kubectl wrapper has the path to kubeconfig file hard coded https://github.com/ubuntu/microk8s/blob/ ...
Read more >Working with kubectl - MicroK8s
Running the following command will output the kubeconfig file from MicroK8s: microk8s config. If you have not already configured kubectl on the host...
Read more >Snap Distribution of Kubectl and KUBECONFIG - Sergio Pino
Making snap's kubectl recognize KUBECONFIG. ... References. Issue 259: microk8s.kubectl does not respect $KUBECONFIG var ↩.
Read more >Kubernetes Provider - hashicorp - Terraform Registry
The provider uses the KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT environment variables to detect when it is running inside a cluster, so in this case ...
Read more >Safely Drain a Node - Kubernetes
Multiple drain commands running concurrently will still respect the ... If you prefer not to use kubectl drain (such as to avoid calling...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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
$KUBECONFIG environment variable
.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.