-
Notifications
You must be signed in to change notification settings - Fork 85
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"swarm init --force-new-cluster" ignores advertise-addr flag #523
Comments
Same problem here, keeps advertising 10.14.x.x IP which is now unreachable, though I force the right adv ip addr:
same without = sign
|
The same problem |
1 similar comment
The same problem |
It seems like related to the unsolved issue moby/moby#34306. |
As my workaround, from master node docker swarm leave -f Then docker swarm init --force-new-cluster --advertise-addr 10.x.x.x |
That isn't a workaround if you care to keep the state of the swarm (secrets, configs, stacks, services, etc.) |
I'm having the same problem here. The initial swarm was created with the wrong ip. Services were deployed. I cannot destroy the swarm state in the fear of loosing something. The advertise-addr does not seem to work as it seems the old ip is stored in the raft consensus database, and retrieved upon force-new-cluster :( |
Hi, I'm in the same situation, did you manage to solve this? Maybe update the IP address in the raft DB with the docker service stopped? |
I was able to restore swarm to a functioning state with high availability with different IP addresses (totally different CIDR range). I'm almost certain this was all of the steps. The next time I need to do it, I'll test these instructions and write it up more properly. This is to help anyone who's been stuck where I was.
iptables -t nat -A OUTPUT -p tcp -d $OLD_NODE_1_IP --dport 2375 -j DNAT --to-destination $NEW_NODE_1_IP:2375
iptables -t nat -A OUTPUT -p tcp -d $OLD_NODE_1_IP --dport 2377 -j DNAT --to-destination $NEW_NODE_1_IP:2377
You're can now join other managers and workers without trouble. Just be sure to get rid of that iptables rule. Preferably by killing that node entirely once you have 5 other managers. HTH |
There has been no other fix for this? Having to recreate an entire swarm just to update the advertise-ip is destructive and time consuming. This problem has been around for ages with no fix. It feels like no work is being done to actually solve this issue because there are "work-arounds", though these are not really viable solutions. We should not have to essentially break the swarm (even more than already is due to this), create a new swarm, then join all members to that. But right now, have no choice to do this, which will result in some downtime and just a late night/early morning. |
Hi, I am facing to problem with moving swarm on different port Data Path Port: 9789. We have created new swarm on port 9789 but all nodes use old 4789. We didnt mention that real communication on ports and only check docker info and this parameter Data Path Port: 9789. It is ok. Now I am trying add new server connected on manager with port 9789 in configuration and new server docker info shows Data Path Port: 9789 and netstat -plun shows 9789 but all servers in swarm still works on default port 4789 and thats way new server cannot communicate with others in swarm. It is very strange and I dont know what was wrong during migration old swarm on port 4789 to new port 9789. Anybody has some experiencie with this strange situation ? It was very hard way move all services,secrets,configs, etc .. to new swarm and everything is the same. |
Expected behavior
If admins follow the instructions on backup/restore (https://docs.docker.com/engine/swarm/admin_guide/), they should be able to transfer old swarm data (secrets, ...) to a new swarm.
When using
docker swarm init --force-new-cluster
to do so, admins should be able to expect other flags (e.g. --advertise-addr) to work as well.
Actual behavior
Following the instructions i was able to restore the secrets of an old swarm to the new one.
Although i set the --advertise-addr to the NEW_IP, the swarm initialization script returns a join command as:
docker swarm join --token long-token-string OLD_IP:2377
Manually changing the IP in the join command allows nodes to join the swarm BUT - as the old advertise addr is pushed to the nodes - things enter fringe mode.
Steps to reproduce the behavior
1.) enter yourCorpNet 10.0.1.0/24, machine 10.0.1.1
2.) init a swarm, no need to join nodes.
3.) store a swarm secret as marker for state backup/restore test.
4.) backup folder, see https://docs.docker.com/engine/swarm/admin_guide/#back-up-the-swarm
5.) enter yourCorpNet 10.0.2.0/24, machine 10.0.2.1
6.) stop docker
7.) restore folder, see https://docs.docker.com/engine/swarm/admin_guide/#restore-from-a-backup
8.) start docker
9.) docker swarm init --force-new-cluster --advertise-addr 10.0.2.1
Output of
docker version
:Output of
docker info
:The text was updated successfully, but these errors were encountered: