How to understand the role of routing mesh
How to understand the role of routing mesh, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
When we access port 8080 of any node, the load balancer inside the swarm forwards the request to one of the copies of the web_server.
That's what routing mesh does.
So no matter which node you visit, even if there is no copy of service running on that node, you will eventually be able to access service.
Alternatively, we can configure an external load balancer to route the request to the swarm service. For example, configure HAProxy to distribute requests to port 8080 of each node.
Ingress network
When we apply-- publish-add 8080 service 80, swarm reconfigures service, and we see what important changes have taken place in the container.
Are you surprised? All previous copies are Shutdown, and then start a new copy. Let's look at the container network configuration for the new copy.
The network of the container is very different from that of publish-add. Now there are two network cards, each of which is connected to a different Docker network.
In fact:
Eth0 connects to an overlay-type network called ingress, which allows containers running on different hosts to communicate with each other.
Eth2 connects to a bridge-type network called docker_gwbridge, and its purpose is to enable the container to access the public network.
The ingress network is created by Docker for us automatically when swarm is created, and every node in swarm can use ingress.
If you are interested in the principle and implementation of Docker overlay network, you can review the previous chapter on Docker container network.
Through the overlay network, hosts and containers, containers and containers can access each other; at the same time, routing mesh routes external requests to the containers of different hosts, thus realizing the external network access to service.
After reading the above, have you mastered how to understand the role of routing mesh? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!