As shown in the picture above, I am dealing with a complex network scenario.
There are two VPCs, the network between VPCs cannot be connected.
There are three consul servers deployed in VPCB, and their IP is vpcB.0, vpcB.1, vpcB.2.
Cloud vendors provide a network connection scheme between two VPCs. After configuration, the data packets sent to vpcA.0 in the VPCA will be forwarded to vpcB.0, and the data packets sent to vpcA.1 will be sent to vpcB.1. The data packet sent to vpcA.2 will be sent to vpcB.2.
In this kind of network, I want to run the consul client in VPCA and connect to the consul server in VPCB. But it doesn’t work properly. I tried the following two configurations:
- Set the
-advertise
of consul server to vpcB.0,vpcB.1,vpcB.2 , set the-retry-join
of consul client to vpcA.0, vpcA.1, vpcA.2 . In this configuration, the consul server cluster can operate normally. However, the consul client will find vpcB.0, vpcB.1, vpcB.2 through gossip, because the consul client in VPCA cannot directly access these ips, the consul client will report an error timeout. - Set the
-advertise
of consul server to vpcA.0,vpcA.1,vpcA.2. In this configuration, the consul server cannot work normally because the consul server in the VPCB cannot access the address in the VPCA.
I spent a lot of time searching for documents and issues, but I couldn’t find a solution. Whether there is any configuration here, it can be returned to different addresses of the client and server. Or is there a problem with the way I use it, in my case, is there any solution?