kubernetes-event-exporter
kubernetes-event-exporter copied to clipboard
Use KUBECONFIG env variable if present
I'm not sure about the problem you are seeing, because I do this kind of thing in testing and it works as-is:
KUBECONFIG=~/.kube/config ./kubernetes-event-exporter -conf k23r-stdout.yaml
So it does seem to honor the KUBECONFIG at least in regard to finding the kubeconfig used to setup the event watcher. I think the machinery for that is built into the upstream client-go code.
You are using the default KUBECONFIG. Even if you dont set that env variable, that will work. However, if your KUBECONFIG is anything other that the default path, it will not work. You can look at the part of the code I am changing. Currently, it reads the path you are mentioning anyway:
return clientcmd.BuildConfigFromFlags("", filepath.Join(os.Getenv("HOME"), ".kube", "config"))