4 ms·
That is basically how consul connect works: https://www.consul.io/docs/connect/native/go.html https://www.consul.io/docs/connect/native/go.html
by justinsaccount 7y ago
That is basically how consul connect works: https://www.consul.io/docs/connect/native/go.html https://www.consul.io/docs/connect/native/go.html
- atombender 7y agoNot as I understand it. It uses DNS resolution, so you connect to something like foo.web.service.consul. Kubernetes's KubeDNS works exactly the same way with Kubernetes service objects.
- justinsaccount 7y agoFrom that page: // Create an instance representing this service. "my-service" is the // name of _this_ service. The service should be cleaned up via Close. svc, _ := connect.NewService("my-service", client) and when http is used: > The hostname used in the request URL is used to identify the logical service discovery mechanism for the target. It's not actually resolved via DNS but used as a logical identifier for a Consul service discovery mechanism. It has the following specific limitations:
- atombender 7y agoAh, I see. That's presumably possible because Go has its own DNS resolver, and it (net.DefaultResolver) can be overridden by libraries; no LD_PRELOAD needed.
- justinsaccount 7y agoit's because connect.NewService is the consul client, not something like net.DialTCP
- atombender 7y agoOh, they require all TCP connections to go through that. That's a bit heavy-handed — requires rewriting all client code to adapt to that pattern. The nice thing about KubeDNS is that you don't have to. Same with Istio.
- peterwwillis 7y agoIntegrating with app code is optional. The default is to use a sidecar.
- justinsaccount 7y agoI brought up the native client because you mentioned "they should have defined a new API".
- atombender 7y agoThat wasn't me. I'd argue the opposite. Though I'd also maybe argue that SRV records is what we should have standardized on for this stuff a long time ago.