Skip to content
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

Allow cert contents in prometheus scrape config tls config #364

Merged
merged 1 commit into from
Jan 22, 2020

Conversation

charleshansen
Copy link
Contributor

For context, on the Bosh team, we are trying to deploy a prometheus in our acceptance environment to try out providing our own metrics. (the bosh-exporter is cool, but very expensive to run, metrics provided directly by Bosh should be much cheaper). The bosh metrics endpoint is secured with mTLS and we need to give certs to the scrape config.

Thanks,
Charles

PR details:

Prometheus wants scrape_config tls_config to use file paths, but it is difficult
to directly put certificates on a vm while deploying with bosh.

If cert_contents are provided, the pre-start script will write the
contents into cert files that prometheus can use when it starts

Prometheus validates that there are not extra keys in its configuration,
so the extra cert contents keys need to be removed.

#169551239

Co-authored-by: Conor Nosal [email protected]

Prometheus wants tls config to be file paths, but it is difficult
directly put certificates on a vm while deploying with bosh.

If cert_contents are provided, the pre-start script will write the
contents into cert files that prometheus can use when it starts

Prometheus validates that there are not extra keys in its configuration,
so the extra cert contents keys need to be removed.

[#169551239](https://www.pivotaltracker.com/story/show/169551239)

Co-authored-by: Conor Nosal <[email protected]>
@charleshansen
Copy link
Contributor Author

charleshansen commented Dec 5, 2019

For reference, an updated scrape_configs: looks like

scrape_configs:
  - job_name: prometheus
     static_configs:
    - targets:
       - localhost:9090
  - job_name: bosh
    static_configs:
    - targets:
      - 10.0.0.6:9091
      scheme: https
      tls_config:
        ca_file: /var/vcap/jobs/prometheus2/certs/ca.cert
        ca_contents: ((metrics_server_client_tls.ca))
        cert_file: /var/vcap/jobs/prometheus2/certs/cert.cert
        cert_contents: ((metrics_server_client_tls.certificate))
        key_file: /var/vcap/jobs/prometheus2/certs/key.cert
        key_contents: ((metrics_server_client_tls.private_key))

@frodenas frodenas merged commit 0b510c7 into cloudfoundry:master Jan 22, 2020
@frodenas
Copy link
Contributor

Thanks @charleshansen! And apologies for the delay merging it :(

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.

2 participants