rancher: Add Amazon EC2 Host sets wrong CATTLE_AGENT_IP when using private IP

Rancher Version: v1.0.2

Docker Version: 1.11.2

OS and where are the hosts located? (cloud, bare metal, etc): Ubuntu 14.04.4 LTS, AWS EC2

Setup Details: (single node rancher vs. HA rancher, internal DB vs. external DB) Rancher HA setup with 3 server nodes using AWS RDS

Environment Type: Cattle

Steps to Reproduce: Use the UI to add a new Host from Amazon EC2, fill in all required fields and select “Use only private IP address”

Results: Instance is created correctly and showing in the UI, but it shows the gateway IP. Also docker inspect rancher-agent shows CATTLE_AGENT_IP is set to the gateway IP. Therefore inter-host communication is not working correctly.

Expected: Agent sets the instances private IP for CATTLE_AGENT_IP

Work around:

  1. log into host over SSH
  2. stop rancher agent with docker stop rancher-agent
  3. go to Add Host and select Custom view in the UI, fill hosts private IP in step 4, copy the generated command from step 5 and run in the shell. After some time the IP is showing correctly in the UI and inter-host communication is working.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 7
  • Comments: 17 (2 by maintainers)

Most upvoted comments

Seriously guys? I really like Rancher, but this ticket is open for 6 months and not even scheduled to fix, which is ridiculous. This bug is blocking people use Rancher with AWS provider if your hosts are not public to the internet with a wide open ssh port. Please fix this.

There’s some info in the troubleshooting docs.

I have created the EC2 instances manually, you also get to specify the ssh key-pair, then ssh in and run:

docker run -d --privileged \
  -e CATTLE_AGENT_IP="$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')"  \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /var/lib/rancher:/var/lib/rancher \
  rancher/agent:v1.0.2 \
  http://<rancher-server>:<rancher-port>/v1/scripts/<token>