Try to add hosts with Piblic and Private IPs - no luck (1.3.0))

As I read about 1.3.0 is out I decided to do fresh install and check it from the group up.

So I set up one VM with two virtual eth ports, assign public IP (so I can ssh to the VM from outside) to one (eth0) of it, and private IP to second (eth1) of it, and with Docker on it. I cloned this VM into two more VM (but changed MACs for eth ports, as well as IPs and hostname inside of the VM), to add the later to Rancher. Then I did know spell like:

sudo docker run -d -v rancher_mysql:/var/lib/mysql --restart=unless-stopped -p 8080:8080 rancher/server

(I did created rancher_mysql volume beforehand) and soon got Rancher 1.3 up and running. Perfect! Then I set it up to use private IP as a management address.

Then I add this VM as a host to Rancher. The spell is known, too:

sudo docker run -e CATTLE_AGENT_IP=“PUBLIC_IP_GOES_HERE” -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.1.3 http://RANCHER_SERVER_PRIVATE_IP:8080/v1/scripts/6EA573E3F6FC7A6823DC:1484323200000:S2n0z0UIk00Qo5DLxtgVFMfk

The host was detected and appeared under Rancher hosts list.

Now I took second VM, and try to add it to Rancher. Run the same command as above

sudo docker run -e CATTLE_AGENT_IP=“PUBLIC_IP_GOES_HERE” -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.1.3 http://RANCHER_SERVER_PRIVATE_IP:8080/v1/scripts/6EA573E3F6FC7A6823DC:1484323200000:S2n0z0UIk00Qo5DLxtgVFMfk

And see what’s on.

And here is the fail: as I add second VM, first VM was substituted with second one in Rancher hosts list. I try to add 3rd VM, did the same trick and 2nd VM disappeared and 3rd appeared instead.

So the question is, how Rancher identities hosts, by which unique name/ip/id? I suspect it should care for IPs and/or hostnames, but it won’t work.

Please advice, I really stuck on that!

Thank you!

/var/lib/rancher/state contains a uuid for the host; you must have included it in your image, so all instances of it are the “same” host. rm -rf it before imaging (and on the existing hosts if you want to keep them, then rerun registration command).

Exactly fixed my problem! Thank you for this help (even at Friday, 13)!