本文转自:http://securityer.lofter.com/post/1d0f3ee7_10c465cc
安装rancher agent时出现以下报错
[root@localhost ~]# sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/ent:v1.2.5 http://192.168.160.130:8080/v1/scripts/6A02DFC097998B0A7659:1483142400000:Eja7GMfVIFpz6o3n017UuZoNNUs
INFO: Running Agent Registration Process, CATTLE_URL=http://192.168.160.130:8080/v1
INFO: Attempting to connect to: http://192.168.160.130:8080/v1
ERROR: http://192.168.160.130:8080/v1 is not accessible (Failed to connect to 192.168.160.130 port 8080: No route to host)
ERROR: http://192.168.160.130:8080/v1 is not accessible (Failed to connect to 192.168.160.130 port 8080: No route to host)
......
原因可能是防火墙引起
[root@localhost ~]# firewall-cmd --state
running
[root@localhost ~]# systemctl stop firewalld
再次执行agent安装
[root@localhost ~]# 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.5 http://192.168.160.130:8080/v1/scripts/6A02DFC097998B0A7659:1483142400000:Eja7GMfVIFpz6o3n017UuZoNNUs
INFO: Running Agent Registration Process, CATTLE_URL=http://192.168.160.130:8080/v1
INFO: Attempting to connect to: http://192.168.160.130:8080/v1
INFO: http://192.168.160.130:8080/v1 is accessible
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=E916F23240672F13BDB3
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://192.168.160.130:8080/v1
INFO: ENV: DETECTED_CATTLE_AGENT_IP=172.17.0.1
INFO: ENV: RANCHER_AGENT_IMAGE=rancher/agent:v1.2.5
INFO: Launched Rancher Agent: f97c2ac8ab0d7862bc2aa694266d2379ef41de06db0e9d7ba3a44b0560758677
OK