Welcome to weblogs.com.pk Sign in | Join | Help


Rancher Series

Containers in general and Docker Containers in particular are becoming popular everyday mainly because they allow us to have a componentized environment to run the applications and host them on premises or in cloud seamlessly. Containers are portable and simple; vendors are adding new features to allow us to create scalable container environments. Containerizing a simple application following Micro-Service Architecture and then making it scalable and high available; things become complex very quickly; managing and running these application becomes daunting. “Container Orchestration Tools” becomes necessity for Production Environments. These tools provide multi-host / cluster aware container manageability, assist in mitigating security and networking issues and provide services that are needed to scale the applications.

Docker has introduced Swarm recently that’s coming in next release, it’s an orchestration platform and being “in the box” will play an important role. Google’s Kubernetes is currently leading but it’s suited for large cloud environment. Its complex and overkill for enterprise and on premises cloud environments. Apache’s Mesos is another option but it’s not just Container Orchestration Tool; it’s designed for general datacenter management. It’s good to know and learn about these tools and what common features they provide so we the developers can assist our system administrators in keeping our application running in the production environment but using the features and services these tools provide can design and develop cloud aware applications by not reinventing the wheel. This series will be about Rancher, its very user friendly, very little learning curve, provide features and services of any modern Container Orchestration Tool and most importantly can be setup on a typical single laptop based development environment.

Rancher comes in two flavors; its a Docker Container available at Docker Hub that you can run on any Docker host; and in its second offering; its a Linux distribution designed especially to run Docker Containers, very similar to Boot2Docker. The distinguishing thing about the RancherOS is that the OS itself runs everything in the Containers.

Rancher provides the network, storage, load balancer and DNS services. It provides Docker Swarn, Kubernetes and Mesos orchestration along with its own implementation. It has application cataloging features and other enterprise grade required features.

Rancher Overview

To set it up, you will need Git Tools installed on your Windows machine, and you will also need Linux friendly editor like Visual Studio Code and Putty’s PSCP tool.

Using Git Shell; create the SSH key using ssh-keygen; it will create id-rsa and id_rsa.pub file. Using the editor; create a cloud-config.yml that will have your public ssh-key from id_rsa.pub file as shown the picture below.


Once the yml file is made with all the required network infrastructure details; we can mount the ISO in the new virtual machine or some physical machine; and boot RancherOS. ISO is available at https://github.com/rancher/os When machine is booted up; simply copy the cloud.config.yml using PSCP (from Putty) to the Rancher Machine. SSH your Rancher machine and issue sudo ros install -c cloud-config.yml -d /dev/sda command and it will download the latest files and install the OS


After an install and reboot; we will have the RancherOS running and we can SSH it from Git Shell using ssh rancher@ip. Its just an OS having an ability to run the Docker Containers. We still need to run the rancher container using sudo docker run –d –restart=always –p 8080:8080 rancher/server and when the Rancher Container is running; we can access its GUI at http://YourRancherMachine:8080


You can view system level containers running in RancherOS using system-docker and user level containers using traditional docker binary


Rancher has concept of hosts; the nodes that act will run the Containers; you need more machines acting as hosts; you add Hosts from Infrastructure option. Typically some Hosts will have Live IPs where you will deploy your public facing apps and some will have internal IPs; its better to have multiple NICs (Network Interfaces) on the Rancher Server machine; you can setup networking in RancherOS using ros config; and for multiple NICs use ros config set rancher.network.interfaces.”mac=11:22:33:44:55:66”; for static ip the commands will be

sudo ros config set rancher.network.interfaces.”mac=11:22:33:44:55:66”.dhcp false
sudo ros config set rancher.network.interfaces.”mac=11:22:33:44:55:66”.gateway
sudo ros config set rancher.network.interfaces.”mac=11:22:33:44:55:66”.address

When we click Add Host button; it gives us the docker run command that we need to run on the node


For the Hosts; rancher/agent Docker container runs on the host, that can be run on the machine that has the Docker installed + configured; it can be any Docker compatible Linux Machine (Physical or VM) . We can use RancherOS as well for the hosts. Its recommended not to use Rancher Server machine as agent; as few components of Rancher Server are made in Java; and you know it needs more resources Smile I created two separate VMs for the hosts and running rancher/agent containers using the commands it asks; they appear shortly in the Infrastructure > Hosts


Theoretically Raspberry Pi can also act as a "Host"; we can use Raspbian and install Docker (Hypriot prepared Docker deb files as discussed in Docker on Raspberry Pi post) and use it; we can use especially made OS/image for Raspberry that has Docker, like the one from Hypriot; or we can use RancherOS that also comes for Raspberry PI.


  • I tried RancherOS on PI; but it was giving weird errors when installing; came to know it was because the memory card I was using was fast Smile so found an old card and used it instead and it installed fine.
  • Sadly it doesn't extend the partition and doesn't use the complete available storage of the card. You have to use GPARTED to extend the partition.
  • There’s no cloud-config.yml to install ROS; instead its offered as memory card image; to set static ip on RancherOS machine; use sudo ros config set rancher.network.interfaces.eth1.address "" followed by sudo system-docker restart network (or reboot)
  • Raspberry Pi is ARM; we cant run / orchestrate x86/x64 containers on Pis; we need ARM images instead
  • Sadly there is no prebuilt ARM rancher/agent container; that needs to run so the PI get listed in Hosts and can be used for orchestration; we need to compile it from source
  • Rancher Server currently cant be compiled on Raspberry Pi; we can only use PIs as hosts / agents; it would be great to have PIs only Rancher Cluster

You can follow these Github Urls for the updates

Published Saturday, July 23, 2016 3:15 PM by khurram


No Comments

New Comments to this post are disabled