Use consul KV in a spring cloud app beside a consul connect sidecar proxy
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 43
Description
Hi team,
it is quite easy to use consul KV feature with a spring cloud app when the app is directly registred to the consul agent.
But when using the sidecar proxy pattern, how can do the spring app (or whatever else techno) to connect to the consul agent and get the KV values ?
In my case I'm using a kubernetes cluster with consul-k8s. My app is deployed with connect inject without any customisation.
3 containers in my pod
-[my api] listening on 127.0.01:9090
-consul-connect-envoy-sidecar
-consul-connect-lifecycle-sidecar
The api registeration is ok in consul and is accessible thru ingress
here is the generated service.hcl
> services {
id = "my-api-deploy-99ff655f7-xcpzq-api-audit-sidecar-proxy"
name = "my-api-sidecar-proxy"
kind = "connect-proxy"
address = "10.42.2.7"
port = 20000
proxy {
destination_service_name = "my-api"
destination_service_id = "my-api-deploy-99ff655f7-xcpzq-my-api"
local_service_address = "127.0.0.1"
local_service_port = 9090
}
checks {
name = "Proxy Public Listener"
tcp = "10.42.2.7:20000"
interval = "10s"
deregister_critical_service_after = "10m"
}
checks {
name = "Destination Alias"
alias_service = "my-api"
}
}
services {
id = "my-api-deploy-99ff655f7-xcpzq-my-api"
name = "my-api"
address = "10.42.2.7"
port = 9090
}
Thx for your help,
I've read learn center without finding my answer
https://learn.hashicorp.com/consul/developer-configuration/consul-template
Contributor guide
Assessment
This issue has not been assessed yet.