Search code examples
dockeragentrancher

Rancher agent can't run on master server?


Using CentOS 7. Docker 1.12.6

Want to install Rancher cluster:

  • master: 192.168.0.100
  • node1: 192.168.0.101
  • node2: 192.168.0.102

Installed rancher server on master host:

$ docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:stable

Until now can access dashboard from browser:

http://192.168.0.100

Process:

$ docker ps
CONTAINER ID    IMAGE                 ... PORTS
9021gn390q49    rancher/server:stable ... 3306/tcp, 0.0.0.0:8080->8080/tcp

Add Host

Want to add master self using self IP address, got command:

$ docker run -e CATTLE_AGENT_IP="192.168.0.100" -e CATTLE_HOST_LABELS='etcd=true&orchestration=true' --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher racher/agent:v1.2.2 http://192.168.0.100:8080/v1/scripts/AJFIOWAEJHOFGH289429:18347207210:xWIJFOHO02HGOEWIH

Then got bad information:

INFO: Running Agent Registration Process, ATTLE_URL=http://192.168.0.100:8080/v1
INFO: Attempting to connect to: http://192.168.0.100:8080/v1
ERROR: http://192.168.0.100:8080/v1 is not accessible
...

But ...

It can add agent from nodes servers! Why can't at master?

Maybe due to the proxy. How to fix it?


Addition

I found host.key file in this path on nodes hosts:

/var/lib/rancher/etc/ssl/

So they can run rightly.

But why not in master host machine?


Solution

  • Can you try adding the host with CATTLE_AGENT_IP="192.168.0.100"?