Installing Rancher on Ubuntu/Docker
On this article we are going to install a rancher server on Ubuntu. Let’s start by getting the rancher image from docker hub:
sudo docker run -d --restart=always -p 8080:8080 --name=rancher-server rancher/server
Go to http://ip-address:8080
and click on Add Host. It is important that you do not use a localhost address (127.0.0.1, localhost). If you do so, and you want to add your local computer as an agent, you will not be able to reach it.
Verify This site’s address is selected and click Save
Follow the instructions presented on the next screen in order to install the rancher service.
Load balancer
On the Rancher website, go to the corresponding stack and select the Add Load Balancer option.
Fill in the required fields as displayed in the following image:
Click on save. After a couple minutes the load balancer will begin dispatching requests on the given addresses/ports.
Rancher on https
You can setup a secure nginx connection by following the instructions on this site:
https://docs.rancher.com/rancher/v1.2/zh/installing-rancher/installing-server/basic-ssl-config/
Troubleshooting
Check container logs:
docker logs -f <container_id>
Check that you can connect to the rancher service (from inside the container):
curl http://127.0.0.1:8080/v1
Check rancher required ports (500 and 4500) are open:
sudo ufw allow proto tcp from <ip-address> to any port 22
References
- Rancher (n.d.). Launching Rancher Server. Retrieved from: http://docs.rancher.com/rancher/latest/en/installing-rancher/installing-server
- Rancher (n.d.). Installing Rancher Server with SSL. Retrieved from: http://docs.rancher.com/rancher/v1.2/en/installing-rancher/installing-server/basic-ssl-config/
- oomathias (2015, July 31). Unable to access Rancher UI after a reboot. Github. Retrieved from: https://github.com/rancher/rancher/issues/1702