[1.6] Single Node Host not working

Specs: Virtualbox, Ubuntu 18.04

I’m trying to get 1.6 up and running on a single node server.

I’m using http:// so I don’t have to handle SSL

But I don’t seem to be able to get it working, even though rancher/server and rancher/agent are both up and running

I tried following this doc for Adding hosts to the same machine as rancher server
https://rancher.com/docs/rancher/v1.6/en/hosts/custom/#adding-hosts-to-the-same-machine-as-rancher-server

rancher/agent:

root@rancher2:~/antsable# sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.11 http://10.10.10.139:8080/v1/scripts/49315AE76842707854A0:1514678400000:6oLsFcibu6Oxjigy8sNMJqewxA

INFO: Running Agent Registration Process, CATTLE_URL=http://10.10.10.139:8080/v1
INFO: Attempting to connect to: http://10.10.10.139:8080/v1
INFO: http://10.10.10.139:8080/v1 is accessible
INFO: Configured Host Registration URL info: CATTLE_URL=http://10.10.10.139:8080/v1 ENV_URL=http://10.10.10.139:8080/v1
INFO: Inspecting host capabilities
INFO: Boot2Docker: false
INFO: Host writable: true
INFO: Token: xxxxxxxx
INFO: Running registration
INFO: Printing Environment
INFO: ENV: CATTLE_ACCESS_KEY=4D37CDC944EE76226B35
INFO: ENV: CATTLE_HOME=/var/lib/cattle
INFO: ENV: CATTLE_REGISTRATION_ACCESS_KEY=registrationToken
INFO: ENV: CATTLE_REGISTRATION_SECRET_KEY=xxxxxxx
INFO: ENV: CATTLE_SECRET_KEY=xxxxxxx
INFO: ENV: CATTLE_URL=http://10.10.10.139:8080/v1
INFO: ENV: DETECTED_CATTLE_AGENT_IP=172.17.0.1
INFO: ENV: RANCHER_AGENT_IMAGE=rancher/agent:v1.2.11
INFO: Launched Rancher Agent: 1fbf9937a8f97f1d03ba7aba07f6babdd8ecff367c47268d8521f9fad7d07cc2

docker logs 1fbf9937a8f97f1d03ba7aba07f6babdd8ecff367c47268d8521f9fad7d07cc2 will show why it can’t be added

Here’s the log output

INFO: Starting agent for CF5028C6EE0844592A73
INFO: Access Key: CF5028C6EE0844592A73
INFO: Config URL: http://10.10.10.139:8080/v1
INFO: Storage URL: http://10.10.10.139:8080/v1
INFO: API URL: http://10.10.10.139:8080/v1
INFO: IP: 10.10.10.139
INFO: Port:
INFO: Required Image: rancher/agent:v1.2.11
INFO: Current Image: rancher/agent:v1.2.11
INFO: Using image rancher/agent:v1.2.11
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
INFO: Downloading agent http://10.10.10.139:8080/v1/configcontent/configscripts
INFO: Updating configscripts
INFO: Downloading http://10.10.10.139:8080/v1//configcontent//configscripts current=
INFO: Running /var/lib/cattle/download/configscripts/configscripts-1-f0f3fb2e1110b5ada7c441705981f93a480313a324294321cff467f0c3e12319/apply.sh
INFO: Sending configscripts applied 1-f0f3fb2e1110b5ada7c441705981f93a480313a324294321cff467f0c3e12319
INFO: Updating pyagent
INFO: Downloading http://10.10.10.139:8080/v1//configcontent//pyagent current=
INFO: Running /var/lib/cattle/download/pyagent/pyagent-1-9e3dcab12585149a65d818082279708965cd826df1937a55b24f48428f8f0c0644fc1033b5be15c88dcf9540b1c04c67/apply.sh
INFO: Updating host-api
INFO: Downloading http://10.10.10.139:8080/v1//configcontent//host-api current=1-9608ead804f8cebbfe95b9f114701d8a5ac4244d603d196068043c902b1a0bdf
INFO: Already up to date
INFO: Sending host-api applied 1-9608ead804f8cebbfe95b9f114701d8a5ac4244d603d196068043c902b1a0bdf
INFO: Updating python-agent
INFO: Downloading http://10.10.10.139:8080/v1//configcontent//python-agent current=1-e621eddbd61f575ce953313f2abe15445a7deb8fc788b32aadb7e024211f46ab
INFO: Already up to date
INFO: Sending python-agent applied 1-e621eddbd61f575ce953313f2abe15445a7deb8fc788b32aadb7e024211f46ab
INFO: Sending pyagent applied 1-9e3dcab12585149a65d818082279708965cd826df1937a55b24f48428f8f0c0644fc1033b5be15c88dcf9540b1c04c67
INFO: Starting agent /var/lib/cattle/pyagent/apply.sh

The docs link you used say to specify the CATTLE_AGENT_IP when running the rancher/agent container but I don’t see that being used in your output.

$ sudo docker run -d -e CATTLE_AGENT_IP=<IP_OF_RANCHER_SERVER> -v /var/run/docker....

Also, can you indicate what is not working?

I used:

docker run -d --restart=unless-stopped -e CATTLE_AGENT_IP=$(hostname --ip-address) -p 80:80 -p 8080:8080 -p 443:443 rancher/server

And then:

sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.11 http://10.10.10.139:8080/v1/scripts/552F5FC70BE3B1F9436D:1514678400000:p1fPVFSUiIv5umQlFvo8APdjYTg

The rancher/server and rancher/agent containers are running, but the host never gets added

root@rancher2:~/antsable# docker ps
CONTAINER ID        IMAGE                   COMMAND                  CREATED              STATUS              PORTS                                                                        NAMES
bfbcf80ef1b8        rancher/agent:v1.2.11   "/run.sh run"            About a minute ago   Up About a minute                                                                                rancher-agent
251c15f49f09        rancher/server          "/usr/bin/entry /usr…"   3 minutes ago        Up 3 minutes        0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:8080->8080/tcp, 3306/tcp   compassionate_jepsen