Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upconsul SD should honor CONSUL_HTTP_ADDR env #5282
Comments
Wing924
changed the title
consul SD should honer CONSUL_HTTP_ADDR env
consul SD should honor CONSUL_HTTP_ADDR env
Feb 28, 2019
This comment has been minimized.
This comment has been minimized.
|
We only take config from one place for simplicity, which is the config file here. What I'd suggest is templating the config file on the host. You might also want to look at k8 service discovery. |
This comment has been minimized.
This comment has been minimized.
For this case, I suggest consul SD server defaults to
I also use k8s SD for metrics inside the k8s cluster while use consul for metrics on outside bare-metal. |
This comment has been minimized.
This comment has been minimized.
|
You can still use k8 SD for that, node mode in particular, to monitor your machine-level infrastructure. |
This comment has been minimized.
This comment has been minimized.
I mean machines outside the k8s cluster, which is managed by consul for a long time. |
This comment has been minimized.
This comment has been minimized.
|
So where's the problem then? Localhost will work on those machines. |
This comment has been minimized.
This comment has been minimized.
When the Prometheus are running on k8s while monitoring targets are on outside, it's not easy to write config. |
Wing924 commentedFeb 28, 2019
•
edited
Proposal
Use case. Why is this important?
Currently, consul SD set server
localhost:8500by default.I suggest change it toos.Getenv("CONSUL_HTTP_ADDR"), faillback tolocalhost:8500if it'snil.Because consuls are running as DaemonSet on k8s and they use host network, we must access them from not localhost but node's IP.
We can't set node's IP on ConfigMap because it's unknown before assign to a node.
ref. Running Consul - Kubernetes - Consul by HashiCorp
update
I suggest consul SD server defaults to "" (empty string).
Go Consul Client will handle the env variable:
https://github.com/hashicorp/consul/blob/master/api/api.go#L27
https://github.com/hashicorp/consul/blob/master/api/api.go#L338
it won't introduce breaking change.