question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

microk8s.kubectl does not respect `$KUBECONFIG` var

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
ktsakalozoscommented, Dec 23, 2018

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.

0reactions
stale[bot]commented, Apr 15, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found