Switch IP address to host address in Ports link under Stacks

The base URL for the link in the Ports section under stacks points to an internal IP used for Rancher services. This should be changed to the host IP or name for resolution to work for users not working on the host machine.

What screen are you looking at? From what I can see, the IP that’s shown is the host address IP.

From the stack view, for an active load balancer, if I click on the port link, it directs me to the Host IP.

If I click on the (i) next to the load balancer name, the summary view of the service gives me the host IP:port in the ports section. I’ve whited out my host IPs.

If I click on the service to get the details of the service, the port page shows me the host IP.

This page. If I hover over the port, I can see that it refers to a 172. address instead of the host IP. So, when my users click on that link, nothing gets resolved unless they are physically logged into the machine. That IP should be the real host IP or the hostname.

Can you share a screen shot of your host?

The 172 IP is most likely the IP set on your host that has the service. Or maybe it was the IP of the host whenever you had launched

If this is the case, then your host didn’t pick up the correct IP.

Since you are running rancher-agent and rancher-server on the same host, the IP might not get picked up, you’d need to update the rancher-agent command to set the correct IP.

http://docs.rancher.com/rancher/rancher-ui/infrastructure/hosts/custom/#adding-hosts-to-the-same-machine-as-rancher-server

Also, if you have services that were already deployed on the host prior to the IP change, I’m not exactly sure what would happen. The service might need ot be restarted to get the correct IP.

The only IPs that are internal to rancher start with 10.42, which are the IPs that we give to the containers in our managed network.

The 172. address is the IP for docker0, not for my host:

/home/dnadave> /sbin/ifconfig
docker0 Link encap:Ethernet HWaddr 02:42:7F:2D:F8:9C
inet addr:172.17.42.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:7fff:fe2d:f89c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13029000 errors:0 dropped:0 overruns:0 frame:0
TX packets:17437182 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2643558859 (2521.0 Mb) TX bytes:22709427034 (21657.3 Mb)

eth0 Link encap:Ethernet HWaddr 00:25:90:C5:53:60
inet addr:10.0.252.112 Bcast:10.0.253.255 Mask:255.255.254.0
inet6 addr: fe80::225:90ff:fec5:5360/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:102887812 errors:0 dropped:75 overruns:0 frame:0
TX packets:54830737 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:67942863907 (64795.3 Mb) TX bytes:27705584868 (26422.1 Mb)
Memory:df520000-df53ffff

You will need to re-register the host (as per indicated) and add the -e CATTLE_AGENT_IP=<host_ip> environment variable.

Please see the special notes about adding a host that is also running rancher-server.

http://docs.rancher.com/rancher/rancher-ui/infrastructure/hosts/custom/#adding-hosts-to-the-same-machine-as-rancher-server

http://docs.rancher.com/rancher/faqs/hosts/#how-does-the-host-determine-ip-address-and-how-can-i-change-it

Note: I’m not sure what will happen with your existing service, but you may need to either re-create it or just restart it.

Since this is just a matter of the fact that your host has picked up the docker0, you just need to re register the host and then your IP for your ports will be correct.

OK, so rather than use CATTLE_AGENT, I need to use CATTLE_AGENT_IP when registering? By register, do you mean deactivate?

Hi @dnadave,

to re-register a Host you need to redo the entire registration of the host, for this you need to first delete some folders on the host, run the following command on the host:

rm -rf /var/lib/rancher/state; docker rm -fv rancher-agent; docker rm -fv rancher-agent-state

once completed you can register the server again with the -e CATTLE_AGENT_IP=<host_ip>