Skip to content

Conversation

@malletgu
Copy link

This MR will allow to inject credentials through environment variables. Also, if credentials are passed in the URI and as arguments, the arguments will overwrite the one in the URI

@pkoraca
Copy link

pkoraca commented Jan 14, 2020

Hi, any chance this might be accepted and released soon? Thanks

@malletgu
Copy link
Author

Hi, any chance this might be accepted and released soon? Thanks

I know it is not ideal but if you're interested I made the Docker in my personal docker hub in the meantime: https://hub.docker.com/r/malletgu/elasticsearch-exporter/tags

@jackatbancast
Copy link

Just want to bump this. As @malletgu mentioned, anyone using the operator from @elastic would have to fork currently, as you can't build an environment variable dynamically in kubernetes.

It would be good to get this merged so that everyone can benefit from any upstream changes.

@jcruzmartini
Copy link

It would be really nice to have this one released soon. I am using K8 and I can not create dynamic env vars
Thanks

sysadmind added a commit to sysadmind/elasticsearch_exporter that referenced this pull request Apr 21, 2020
@sysadmind
Copy link
Contributor

I was able to use this PR to get metrics from an ECK elasticsearch cluster. I can confirm that this works when specifying the URl (pointing to the kubernetes service) and setting the credentials through the variables.

One thing to note is that I was not able to use the secret that ECK created directly with the helm/stable chart. The secret "key" is set to the user name and the value is the password. You can do something like the following though (maybe this needs to be a PR to the helm chart).

env:
- name: ES_USERNAME
  value: "elastic"
- name: ES_PASSWORD
    valueFrom:
    secretKeyRef:
        name: my-cluster-es-elastic-user
        key: elastic

@ambis
Copy link

ambis commented Apr 25, 2020

Just stumbeled on this problem and this PR seems to solve it nicely! Waiting for merge...

@schrej
Copy link

schrej commented May 4, 2020

While this is convenient it's already possible to do this, see my comment on the issue.

@kfox1111
Copy link

+1 to getting this functionality merged. Having to create a new secret and keep it synchronized is not as good as referencing the secret in an existing secret.

Glad there is a workable workaround though.

@kfox1111
Copy link

Actually, it looks like you can use
extraEnvSecrets:
ES_PASSWORD:
secret: foo-elastic-user
key: elasticsearch

to do the job...

So the chart does work as is.

Maybe an example might help? The configuration can be made to work as is, but its not very clear how to do it.

@pazoozooCH
Copy link

+1

@smforsberg
Copy link

I would definitely encourage this being merged. The solution in the other case is fragile as it requires a strict ordering of multiple blocks of a helm chart interacting with its service. We can already see the example using extraEnvSecrets failing when several has implemented it (thus requiring the envFromSecret method). This will almost guaranteed cause a future breakage.

As this utility/exporter is for only elastic, it makes sense to support the elastic authorization methods which includes username/password without having to code along with URI (which makes secret management but discoverability of remote connection) more difficult.

Copy link
Contributor

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change allows setting the password on the command line as a flag. This is unsafe and we should not support this.

@guillaumelecerf
Copy link
Contributor

guillaumelecerf commented Jul 28, 2021

@SuperQ : Maybe the approach in #461 would be acceptable ?

@guillaumelecerf
Copy link
Contributor

#461 is now merged.

@sysadmind sysadmind closed this Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.