I have a working setup of consul service mesh using tproxy on virtual machines. I am able to reach to service running a VM using service.virtual.consul address from another VM that is in the mesh.
I want to now connect to the external service and make it accessible inside the mesh as external.virtual.consul.
This is what I have done so far,
Added a config entry for terminating gateway as
Kind = "terminating-gateway"
Name = "managed-service-gateway"
Services = [
{
Name = "external-service"
}
]
After all of this, I could see on the consul dashboard that the external service is now linked under the terminating gateway and in service mesh with the gateway.
When I do run dig external-service.virtual.consul, I could see a virtual IP assigned however, when I try to connect to the external service using mysql -ufoo -h external-service.virtual.consul -p, connection is hanging up with an error “Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0”. However I can connect to the underlying external service without any problems outside of the mesh.
I’ve tried adding with and without redirect-traffic on terminating gatway’s VM but no help. What am I missing?
I am trying to connect it from inside the VM of another service. This VM has a consul agent and envoy proxy running along with firewall redirection rules applied.
My overall setup
There are 3 services registered - 2 normal services lets call it foo and bar, 1 external service external-service which is MySQL.
foo and bar are running on 2 independent VMs. These VMs have consul agent and envoy proxy running and have the firewall redirection rules applied using redirect-traffic.
From foo’s VM, I can make API call to bar using curl bar.virtual.consul, however, from the same VM I am unable to connect to MySQL
Along with MySql, I also registered another external service that works on http. Lets call it baz. I followed the same steps as registering it via v1/catalog/register api and then updated the terminating gateway config entry to include baz service.
This time, when I hit curl baz.virtual.consul from foo’s VM, it worked! That implies for some reason, http based traffic is working fine.
Probably it has to do with proxy defaults? Here is my proxy default config