I had setup a new cluster with the comand :
docker swarm init --default-addr-pool 192.168.100.24/24 --default-addr-pool-mask-length 26
and i join two node as manager (so a cluster of 3 nodes: apppool-1, apppool-2, apppool-3, all as managers)
The 3 nodes ip are:
apppool-1 10.205.11.205/22
apppool-2 10.205.11.210/22
apppool-3 10.205.11.211/22
and deploy a simple nginx service:
docker service create --name mytestweb --replicas 1 --publish published=8083,target=80,mode=ingress nginx
docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
jc8h5ztsy5gk mytestweb replicated 1/1 nginx:latest *:8083->80/tcp
The service is running on the apppool-1
root@apppool-1:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
74c7d6ee4d70 nginx:latest "/docker-entrypoint.…" 18 minutes ago Up 18 minutes 80/tcp mytestweb.1.uw5ie6z4hveu1ahu7806l88hq
Some “inspect” comand:
docker network ls
NETWORK ID NAME DRIVER SCOPE
8f4480d8b21d bridge bridge local
612c3c3897de docker_gwbridge bridge local
7028cf00471d host host local
nqqth5f1l98o ingress overlay swarm
98fb2472ad2f none null local
root@apppool-1:~# docker network inspect docker_gwbridge
[
{
"Name": "docker_gwbridge",
"Id": "8facc7ac6d404ef5de5abc41c066ab16b9f655129353329b2205d719b8474555",
"Created": "2022-07-11T15:58:45.571785528+02:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"74c7d6ee4d70ef7cbaaedb5ba221b41743dd49d0a45c7ad78312bf8bd47c6774": {
"Name": "gateway_2f2dae3bca89",
"EndpointID": "871864f70c087c3245cbd079793d1c7ed97ac4b218e3eff61b1a47109e94a946",
"MacAddress": "02:42:ac:12:00:03",
"IPv4Address": "172.18.0.3/16",
"IPv6Address": ""
},
"ingress-sbox": {
"Name": "gateway_ingress-sbox",
"EndpointID": "e6f12dc85f6cbc45f72f8b63fe7ecc24e6dd1416a8e14b02d8f2702e92d4c1b6",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.enable_icc": "false",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.name": "docker_gwbridge"
},
"Labels": {}
}
]
root@apppool-1:~# docker network inspect ingress
[
{
"Name": "ingress",
"Id": "nqqth5f1l98ou10ompfshd3ik",
"Created": "2023-01-04T10:28:14.77374724+01:00",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "192.168.100.0/26",
"Gateway": "192.168.100.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": true,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"74c7d6ee4d70ef7cbaaedb5ba221b41743dd49d0a45c7ad78312bf8bd47c6774": {
"Name": "mytestweb.1.uw5ie6z4hveu1ahu7806l88hq",
"EndpointID": "8c772610c1a5aaf015bf29022d069fa8ab644e198cfb6a344cc725685dea3ea9",
"MacAddress": "02:42:c0:a8:64:06",
"IPv4Address": "192.168.100.6/26",
"IPv6Address": ""
},
"ingress-sbox": {
"Name": "ingress-endpoint",
"EndpointID": "55f53eeb1bc4be5fbe96940e99090c35719f4d805b7168d9d26d09ea72991f2e",
"MacAddress": "02:42:c0:a8:64:02",
"IPv4Address": "192.168.100.2/26",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "4096"
},
"Labels": {},
"Peers": [
{
"Name": "2abf3f8dbe87",
"IP": "10.205.11.205"
},
{
"Name": "0240e192ad2d",
"IP": "10.205.11.210"
},
{
"Name": "a553104340c5",
"IP": "10.205.11.211"
}
]
}
]
root@apppool-1:~# docker network inspect bridge
[
{
"Name": "bridge",
"Id": "f375fa547dae93b34b0fae10267f5e7a61f26f5227bf1f591ce216907d917c88",
"Created": "2023-01-03T16:15:50.969878515+01:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
root@apppool-2:~# docker network inspect docker_gwbridge
[
{
"Name": "docker_gwbridge",
"Id": "63ed9fd2c0bf1c0e065b79ff526cf6db67316995b83f1810ea4e9483e52e4def",
"Created": "2022-08-12T16:30:53.671887535+02:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"ingress-sbox": {
"Name": "gateway_ingress-sbox",
"EndpointID": "241d4638bebe8bc1d7ed9dd79052411d1d5af00cb85cde961ea49bc9460ea38e",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.enable_icc": "false",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.name": "docker_gwbridge"
},
"Labels": {}
}
]
root@apppool-2:~# docker network inspect ingress
[
{
"Name": "ingress",
"Id": "nqqth5f1l98ou10ompfshd3ik",
"Created": "2023-01-04T10:28:34.146028458+01:00",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "192.168.100.0/26",
"Gateway": "192.168.100.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": true,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"ingress-sbox": {
"Name": "ingress-endpoint",
"EndpointID": "a90cfc98376691b2f6f7ea663918a50b3dbc08515ecce1d505cbea60007d09a0",
"MacAddress": "02:42:c0:a8:64:03",
"IPv4Address": "192.168.100.3/26",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "4096"
},
"Labels": {},
"Peers": [
{
"Name": "2abf3f8dbe87",
"IP": "10.205.11.205"
},
{
"Name": "0240e192ad2d",
"IP": "10.205.11.210"
},
{
"Name": "a553104340c5",
"IP": "10.205.11.211"
}
]
}
]
root@apppool-2:~# docker network inspect bridge
[
{
"Name": "bridge",
"Id": "fe99090bbb9f002fb34b44f845774b245bfa6d9fa26f656639493baf8f6288d5",
"Created": "2023-01-03T17:03:40.709820594+01:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
root@apppool-3:~# docker network inspect docker_gwbridge
[
{
"Name": "docker_gwbridge",
"Id": "612c3c3897dea2dacf5b6b37de53d49bf66d7120cff68a88ffc74238691b9e96",
"Created": "2022-08-17T11:00:54.913689601+02:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"ingress-sbox": {
"Name": "gateway_ingress-sbox",
"EndpointID": "ca13bb2c82747d8e39c03881d3042e5ba11153289c03541622e24431ec1c6cd9",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.enable_icc": "false",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.name": "docker_gwbridge"
},
"Labels": {}
}
]
root@apppool-3:~# docker network inspect ingress
[
{
"Name": "ingress",
"Id": "nqqth5f1l98ou10ompfshd3ik",
"Created": "2023-01-04T10:29:17.422388709+01:00",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "192.168.100.0/26",
"Gateway": "192.168.100.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": true,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"ingress-sbox": {
"Name": "ingress-endpoint",
"EndpointID": "4787231486a276dc71de6fc02d25bf8c9d7e6c573a9cfd49fd846a68e55cf866",
"MacAddress": "02:42:c0:a8:64:04",
"IPv4Address": "192.168.100.4/26",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "4096"
},
"Labels": {},
"Peers": [
{
"Name": "2abf3f8dbe87",
"IP": "10.205.11.205"
},
{
"Name": "0240e192ad2d",
"IP": "10.205.11.210"
},
{
"Name": "a553104340c5",
"IP": "10.205.11.211"
}
]
}
]
root@apppool-3:~# docker network inspect bridge
[
{
"Name": "bridge",
"Id": "8f4480d8b21d9787e31895f9369c01bae9df640b82274313e68a5239bb7c6708",
"Created": "2023-01-03T18:17:14.324188094+01:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
The MTU:
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:b4:f7:71 brd ff:ff:ff:ff:ff:ff
altname enp11s0
inet 10.205.11.205/22 brd 10.205.11.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:feb4:f771/64 scope link
valid_lft forever preferred_lft forever
3: docker_gwbridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:f8:5f:f7:bd brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 brd 172.18.255.255 scope global docker_gwbridge
valid_lft forever preferred_lft forever
inet6 fe80::42:f8ff:fe5f:f7bd/64 scope link
valid_lft forever preferred_lft forever
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:3b:3c:bb:5e brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
37: vetha7422a1@if36: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker_gwbridge state UP group default
link/ether ca:da:25:92:ad:1d brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet6 fe80::c8da:25ff:fe92:ad1d/64 scope link
valid_lft forever preferred_lft forever
41: vethe8146b1@if40: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker_gwbridge state UP group default
link/ether ce:c6:ac:5b:64:f3 brd ff:ff:ff:ff:ff:ff link-netnsid 2
inet6 fe80::ccc6:acff:fe5b:64f3/64 scope link
valid_lft forever preferred_lft forever
root@apppool-2:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:b4:87:0b brd ff:ff:ff:ff:ff:ff
altname enp11s0
inet 10.205.11.210/22 brd 10.205.11.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:feb4:870b/64 scope link
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:00:62:32:91 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:ff:fe62:3291/64 scope link
valid_lft forever preferred_lft forever
4: docker_gwbridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:57:a0:f9:6d brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 brd 172.18.255.255 scope global docker_gwbridge
valid_lft forever preferred_lft forever
inet6 fe80::42:57ff:fea0:f96d/64 scope link
valid_lft forever preferred_lft forever
48: vethd7408f9@if47: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker_gwbridge state UP group default
link/ether be:ec:c5:4b:d8:35 brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet6 fe80::bcec:c5ff:fe4b:d835/64 scope link
valid_lft forever preferred_lft forever
root@apppool-3:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:b4:47:9f brd ff:ff:ff:ff:ff:ff
altname enp11s0
inet 10.205.11.211/22 brd 10.205.11.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:feb4:479f/64 scope link
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:13:21:fb:b3 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
4: docker_gwbridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:0a:40:fc:00 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 brd 172.18.255.255 scope global docker_gwbridge
valid_lft forever preferred_lft forever
inet6 fe80::42:aff:fe40:fc00/64 scope link
valid_lft forever preferred_lft forever
10: veth9e72e17@if9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker_gwbridge state UP group default
link/ether 0e:11:b7:97:dd:92 brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet6 fe80::c11:b7ff:fe97:dd92/64 scope link
valid_lft forever preferred_lft forever
Unfortunately the service is not reachable via the nodes where it is not running.
root@apppool-3:~# wget http://apppool-3:8083
--2023-01-04 10:46:40-- http://apppool-3:8083/
Résolution de apppool-3 (apppool-3)… 10.205.11.211
Connexion à apppool-3 (apppool-3)|10.205.11.211|:8083… ^C
root@apppool-3:~# wget http://apppool-2:8083
--2023-01-04 10:46:47-- http://apppool-2:8083/
Résolution de apppool-2 (apppool-2)… 10.205.11.210
Connexion à apppool-2 (apppool-2)|10.205.11.210|:8083… ^C
root@apppool-3:~# wget http://apppool-1:8083
--2023-01-04 10:46:54-- http://apppool-1:8083/
Résolution de apppool-1 (apppool-1)… 10.205.11.205
Connexion à apppool-1 (apppool-1)|10.205.11.205|:8083… connecté.
requête HTTP transmise, en attente de la réponse… 200 OK
Taille : 615 [text/html]
Sauvegarde en : « index.html.1 »
index.html.1 100%[==========================================================================================================>] 615 --.-KB/s ds 0s
2023-01-04 10:46:54 (63,9 MB/s) — « index.html.1 » sauvegardé [615/615]
Edit: To complete the analys i run a tcpdump when trying to reach my service, the ingress IP address seem to be used to connect to the others nodes (192.168.100.X). I don’t know why docker use this ip address wich is not bind to any network interface
"917","2023-01-04 11:51:23,618404","192.168.100.4","37288","192.168.100.6","8083","TCP","124","[TCP Retransmission] 37288 → 8083 [SYN] Seq=0 Win=65495 Len=0 MSS=65495 SACK_PERM=1 TSval=874079223 TSecr=0 WS=128"
"1061","2023-01-04 11:51:25,634397","192.168.100.4","37288","192.168.100.6","8083","TCP","124","[TCP Retransmission] 37288 → 8083 [SYN] Seq=0 Win=65495 Len=0 MSS=65495 SACK_PERM=1 TSval=874081239 TSecr=0 WS=128"
"1393","2023-01-04 11:51:29,826388","192.168.100.4","37288","192.168.100.6","8083","TCP","124","[TCP Retransmission] 37288 → 8083 [SYN] Seq=0 Win=65495 Len=0 MSS=65495 SACK_PERM=1 TSval=874085431 TSecr=0 WS=128"