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

Feature request: Support Consul Connect #4313

Open
roidelapluie opened this Issue Jun 26, 2018 · 7 comments

Comments

Projects
None yet
2 participants
@roidelapluie
Copy link
Contributor

roidelapluie commented Jun 26, 2018

Consul Connect is a new open source feature of consul that enables secure communications with TLS for services connected to consul.

https://www.hashicorp.com/blog/consul-1-2-service-mesh

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jun 26, 2018

Can you explain more about what this is? We already support TLS connections for Consul SD.

@roidelapluie

This comment has been minimized.

Copy link
Contributor Author

roidelapluie commented Jun 26, 2018

Consul Connect is a new feature of Consul (currently beta) that enables transparent TLS connection between services configured by Consul. It means that prometheus could transparently scrape metrics using tls, with a local proxy.

@roidelapluie

This comment has been minimized.

Copy link
Contributor Author

roidelapluie commented Jun 26, 2018

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jun 26, 2018

I've read the docs, but they're not very illuminating. How does this work under the covers?

We don't support bespoke auth mechanisms as that would be a maintenance nightmare, so unless this is a standard http proxy (which we already support) it's unlikely this will be supported. Prometheus would also continue to need access to individual instances, which I'm not sure if this provides. If there's new metadata (which I presume there is) we can expose it via SD.

@roidelapluie

This comment has been minimized.

Copy link
Contributor Author

roidelapluie commented Jun 26, 2018

Here it is, a small POC.

in consul.d, add prometheus.json

{                                                                                                                                         
   "service": {
      "connect": {
         "proxy": {
            "config": {
               "upstreams": [
                  {
                     "destination_name": "prometheus",
                     "local_bind_port": 1234
                  }
               ]
            }
         }
      },
      "name": "prometheus",
      "port": 9090
   }
}

Run:

consul agent -dev -config-dir=consul.d

Run prometheus.

Then, you can connect to http://127.0.0.1:1234 (not https); that will use tls behind the scene.

Multiple questions remain:

  1. How can we fetch metrics of all the services? Because port 1234 currently will redirect you to one of the sane services.
  2. how can we get the extra metadata to know which port to connect to?

So my assumption for the two answers before is that we would need to implement connect client directly inside prometheus. While that should not be that much work that would still be work.

Maybe we can also take this outside of prometheus and try to make a consul-connect file_sd provider but because there are so many prometheus users using consul that would be sad.

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jun 26, 2018

So my assumption for the two answers before is that we would need to implement connect client directly inside prometheus. While that should not be that much work that would still be work.

I don't think it's appropriate to start implementing service mesh support inside Prometheus (we can't maintain SDs as-is, we don't need a whole new category of thing to maintain). If someone needs this they can always use the existing proxy_url.

Maybe we can also take this outside of prometheus and try to make a consul-connect file_sd provider but because there are so many prometheus users using consul that would be sad.

Presuming you can solve 1., this would likely be possible with consul_sd, some new metadata, and relabelling. You'd probably still need a connect-aware proxy though.

there are so many prometheus users using consul that would be sad.

That's kinda like saying that Prometheus supports EC2 SD, so why doesn't it support using RDS as a backing store. Discovery and scraping are different layers of the stack.

@roidelapluie

This comment has been minimized.

Copy link
Contributor Author

roidelapluie commented Jun 27, 2018

I have opened hashicorp/consul#4298

If it gets implemented, I will write some documentation about that (& blog posts).

In the meantime let's keep this issue open ; maybe I will get other ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.