Summary
The thing is, the original ip of the cluster running docker swarm on Shumei pie was 192.168.0.113, and then because of the move, the ip became 192.168.11.113. The next thing you can think of is that node and manager are definitely not connected. So I moved the node out of the cluster and rejoined it, but the join token command at that time was as follows
╰─➤ docker swarm join-token worker To add a worker to this swarm, run the following command: docker swarm join --token SWMTKN-1-0shhd0b7uwajhgymxgpp1nv5u17jvcup9vvmhnqkg77ds57e5h-57e7hvjaxaagxtxddz416q5z2 192.168.0.113:2377
At that time, I directly changed the final ip to 192.168.11.113 so that node can join the cluster, yes, it can join, but somehow, node still goes to 192.168.0.113 to connect, resulting in an error.
╰─➤ tail -f daemon.log 1 ↵ Jul 4 08:07:16 pi-slave dockerd[21221]: time="2018-07-04T08:07:16.316088897Z" level=info msg="grpc: addrConn.resetTransport failed to create client transport: connection error: desc = \"transport: dial tcp 192.168.0.113:2377: getsockopt: no route to host\"; Reconnecting to {192.168.0.113:2377 <nil>}" module=grpc Jul 4 08:07:16 pi-slave dockerd[21221]: time="2018-07-04T08:07:16.317349637Z" level=info msg="Failed to dial 192.168.0.113:2377: grpc: the connection is closing; please retry." module=grpc Jul 4 08:07:19 pi-slave dockerd[21221]: time="2018-07-04T08:07:19.316151478Z" level=info msg="grpc: addrConn.resetTransport failed to create client transport: connection error: desc = \"transport: dial tcp 192.168.0.113:2377: getsockopt: no route to host\"; Reconnecting to {192.168.0.113:2377 <nil>}" module=grpc Jul 4 08:07:22 pi-slave dockerd[21221]: time="2018-07-04T08:07:22.318750223Z" level=info msg="grpc: addrConn.resetTransport failed to create client transport: connection error: desc = \"transport: dial tcp 192.168.0.113:2377: getsockopt: no route to host\"; Reconnecting to {192.168.0.113:2377 <nil>}" module=grpc Jul 4 08:07:22 pi-slave dockerd[21221]: time="2018-07-04T08:07:22.319398354Z" level=error msg="agent: session failed" backoff=8s error="rpc error: code = Unavailable desc = grpc: the connection is unavailable" module=node/agent node.id=yi1u62gxyockd23h2z4nm3of1 Jul 4 08:07:22 pi-slave dockerd[21221]: time="2018-07-04T08:07:22.319955650Z" level=info msg="manager selected by agent for new session: {h6i2x0hals6za31uya16zlmli 192.168.0.113:2377}" module=node/agent node.id=yi1u62gxyockd23h2z4nm3of1 Jul 4 08:07:22 pi-slave dockerd[21221]: time="2018-07-04T08:07:22.320147058Z" level=info msg="waiting 7.379239722s before registering session" module=node/agent node.id=yi1u62gxyockd23h2z4nm3of1 Jul 4 08:07:25 pi-slave dockerd[21221]: time="2018-07-04T08:07:25.315780534Z" level=info msg="grpc: addrConn.resetTransport failed to create client transport: connection error: desc = \"transport: dial tcp 192.168.0.113:2377: getsockopt: no route to host\"; Reconnecting to {192.168.0.113:2377 <nil>}" module=grpc Jul 4 08:07:25 pi-slave dockerd[21221]: time="2018-07-04T08:07:25.318872383Z" level=info msg="Failed to dial 192.168.0.113:2377: grpc: the connection is closing; please retry." module=grpc Jul 4 08:07:25 pi-slave dockerd[21221]: time="2018-07-04T08:07:25.318573109Z" level=info msg="grpc: addrConn.resetTransport failed to create client transport: connection error: desc = \"transport: dial tcp 192.168.0.113:2377: getsockopt: no route to host\"; Reconnecting to {192.168.0.113:2377 <nil>}" module=grpc Jul 4 08:07:28 pi-slave dockerd[21221]: time="2018-07-04T08:07:28.316269050Z" level=info msg="grpc: addrConn.resetTransport failed to create client transport: connection error: desc = \"transport: dial tcp 192.168.0.113:2377: getsockopt: no route to host\"; Reconnecting to {192.168.0.113:2377 <nil>}" module=grpc Jul 4 08:07:31 pi-slave dockerd[21221]: time="2018-07-04T08:07:31.331695034Z" level=info msg="grpc: addrConn.resetTransport failed to create client transport: connection error: desc = \"transport: dial tcp 192.168.0.113:2377: getsockopt: no route to host\"; Reconnecting to {192.168.0.113:2377 <nil>}" module=grpc Jul 4 08:07:31 pi-slave dockerd[21221]: time="2018-07-04T08:07:31.332270925Z" level=error msg="agent: session failed" backoff=8s error="rpc error: code = Unavailable desc = grpc: the connection is unavailable" module=node/agent node.id=yi1u62gxyockd23h2z4nm3of1 Jul 4 08:07:31 pi-slave dockerd[21221]: time="2018-07-04T08:07:31.332991816Z" level=info msg="manager selected by agent for new session: {h6i2x0hals6za31uya16zlmli 192.168.0.113:2377}" module=node/agent node.id=yi1u62gxyockd23h2z4nm3of1 Jul 4 08:07:31 pi-slave dockerd[21221]: time="2018-07-04T08:07:31.333203172Z" level=info msg="waiting 1.698796755s before registering session" module=node/agent node.id=yi1u62gxyockd23h2z4nm3of1
After that, I asked in the qq group facebook whether there was no one who could give a positive solution, nor could it be possible to regenerate join token.
╭─root@pi-master /etc/default ╰─➤ docker swarm join-token --rotate worker Successfully rotated worker join token. To add a worker to this swarm, run the following command: docker swarm join --token SWMTKN-1-0shhd0b7uwajhgymxgpp1nv5u17jvcup9vvmhnqkg77ds57e5h-34adsf2isqqqnn7gd5hnhumdh 192.168.0.113:2377
If the generated ip is 192.168.0.113, then there is no way, because the test environment can only solve the problem of rebuilding the cluster violently.
Rebuilding Clusters
First, we cluster worker and manager directly. First, we leave node.
docker swarm leave --force
Then there's manager.
docker swarm leave --force
Because I don't have any important containers on my machine, I did it directly.
Then rebuild the cluster
╭─root@pi-master /etc/default ╰─➤ docker swarm init Swarm initialized: current node (wylbqh0q0p0yromn6hh44jrvx) is now a manager. To add a worker to this swarm, run the following command: docker swarm join --token SWMTKN-1-0n8n2vbtnuksw78opuex5hhtgffzn36dbii7u1dp5rrul8z85p-3buc8f7h2n8st570hcx9lwthk 192.168.11.113:2377 To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
You can see that the ip above has changed to 192.168.11.113. Join Nodes in Clusters
docker swarm join --token SWMTKN-1-0n8n2vbtnuksw78opuex5hhtgffzn36dbii7u1dp5rrul8z85p-3buc8f7h2n8st570hcx9lwthk 192.168.11.113:2377
Finally, take a look at docker's log
╭─root@pi-slave /var/log ╰─➤ tail -f daemon.log Jul 4 08:34:35 pi-slave dhcpcd[517]: docker_gwbridge: using IPv4LL address 169.254.160.155 Jul 4 08:34:35 pi-slave avahi-daemon[306]: Registering new address record for 169.254.160.155 on docker_gwbridge.IPv4. Jul 4 08:34:35 pi-slave dhcpcd[517]: docker_gwbridge: adding route to 169.254.0.0/16 Jul 4 08:34:35 pi-slave dhcpcd[517]: veth06a7c80: using IPv4LL address 169.254.142.194 Jul 4 08:34:35 pi-slave avahi-daemon[306]: Joining mDNS multicast group on interface veth06a7c80.IPv4 with address 169.254.142.194. Jul 4 08:34:35 pi-slave avahi-daemon[306]: New relevant interface veth06a7c80.IPv4 for mDNS. Jul 4 08:34:35 pi-slave avahi-daemon[306]: Registering new address record for 169.254.142.194 on veth06a7c80.IPv4. Jul 4 08:34:35 pi-slave dhcpcd[517]: veth06a7c80: adding route to 169.254.0.0/16 Jul 4 08:34:38 pi-slave dhcpcd[517]: veth06a7c80: no IPv6 Routers available Jul 4 08:34:38 pi-slave dhcpcd[517]: docker_gwbridge: no IPv6 Routers available
ok, everything's ok.
It's worth noting that after I did this, all the containers were gone, almost once the cluster was reinstalled, so it's certainly not the best solution. If anyone knows how to deal with this problem, please contact me and let me know.
Then you can create the container.
docker network create --driver=overlay --subnet=192.168.12.1/24 visualizer
It's worth noting that when you create the overlay network in manager, if you don't create containers or other operations that can affect the worker node, then you can't see the network on the worker node. Create container
docker service create --name visualizer --replicas=3 --publish=8088:8080 --network=visualizer --mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock alexellis2/visualizer-arm
Welcome to Bboysoul's blog www.bboysoul.com Have Fun