Bootstrapping Rancher 2.0

on Oct 3, 2017

It’s finally here: the Rancher you’ve all been waiting for. Rancher 2.0 is now in preview mode and available to deploy!

Rancher 2.0 brings us a whole new Kubernetes-based structure, with new features like platform-wide multi-select, adoption of existing Kubernetes clusters, and much, much more.

If you’re looking to dive in with Rancher 2.0, you’ve come to the right place.


  1. You have a Linux host with at least 4 GB of RAM.
  2. The host has the latest stable version of Docker installed.
  3. The host is publicly accessible via an IP address or hostname.
  4. The host is not behind a firewall or has port 80 and 22 open in the firewall.

Running the Rancher 2.0 Server

Rancher 2.0 is currently in technical preview mode, meaning it’s under the :preview tag on our Docker Hub image.

To launch the Rancher 2.0 Docker container, you’ll need to run the following command:

$ sudo docker run -d --restart=unless-stopped -p 80:8080 rancher/server:preview

This command ensures the container is up and running and that port 80 on the host is mapped to 8080 inside the container, where the Rancher server listens by default.

Once the container is up and running, navigate to http://[hostname/ip]:80 to see the Rancher 2.0 interface.

We recommend you enable telemetry collection, as the more data we get from end users like yourself, the better we can make our product.

Unlike in previous versions of Rancher, the preview doesn’t yet support Access Control settings, so your instance will be unsecured until a stable RC is released for 2.0.

That’s all it takes to get Rancher 2.0 up and running! How about we spin up some hosts and get a container or two ready to go?

Image of Rancher 2.0 Interface 

Adding Hosts to Rancher 2.0

To add hosts in 2.0, we follow a similar process to previous versions of Rancher. However, the menus have been slightly changed.

To get to our hosts, we’ll want to click the Hosts item in the navbar at the top of the page.

Hosts menu item 

Then, click Add Host and we’ll be presented with a new host configuration page.

Add Hosts 

For the purposes of this demo, I’ll be using DigitalOcean as my cloud infrastructure, but you can enable more providers under Admin -> Machine Drivers.

Admin -> Machine Drivers 

I’ll name the instance rancher-preview-host-01 and scale to three hosts.

All that’s left is to enter our Access Token because we’re using DigitalOcean as our infrastructure.

Clicking Next modifies the window and show us a few more settings.

More Host Settings 

We’ll want to leave all the settings as they are for now. However, if you have a more complex setup, feel free to modify these settings to fit your needs.

We also want to tick Enable Private Networking to allow for smoother communication between hosts and our controller.

Enable Private Networking 

Then, hit Create and watch the magic happen as our hosts are created, accessed, and provisioned for Rancher.

This process can take a few minutes, so you might want to make a cup of tea or something.

When all of our hosts are green and ready for deployment, we can get started by launching a container or two.

Ready for Launch 

Deploying Containers on Rancher 2.0

Let’s hop on over to the Containers menu to launch a new container!

Containers menu item 

We’re presented with a new but also familiar container interface, with a tabbed menu showing us a few different container-related options, including load balancers, and DNS.

New Container Interface 

The most basic way to test out the new Rancher is, as always, with a load-balanced Hello World application.

We’re going to click Add Container to get started with this incredibly complex application.

Add Container 

Let’s name it hello-world, use the image tutum/hello-world from Docker Hub to run a simple HTTP service, and then change the scaling options to run a Global service with a scale of 1 container per host.

After this configuration, our settings should look like this example:

Filled out Add Container 

All that’s left is to click Launch and the containers will spin up.

After launching, we’re directed back to the Containers page, and now we see a Default stack with a single service in it, our hello-world service.

Container Interface with Stacks 

The next step is to create a load balancer for this service.

Load Balancing in Rancher 2.0

To get started, click Balancers on the Containers page.

Balancers Nav 

Next, we want to click Add Balancer to get to the new Add Load Balancer interface as shown below:

New Load Balancer Interface 

We can name this load balancer hello-lb, scale it to a Global service with a scale of 1 container per host, then configure the listener and target rule as follows: Listening Port: 80, Protocol: HTTP, Access: Public, Host IP: [leave blank].

We want to create a target rule by clicking Add a Service, then leave the Request Host and Path empty, but select our hello-world service from the Target drop-down list. We’ll want to use port 80 because our Hello World service listens on port 80.

After configuration, our page should look like this example:

Configured Load Balancer 

All that’s left is to click Create to spin up our load balancers.

We’ll now see a Default stack in our Balancers interface showing the hello-lb balancers coming up.

If we go back to our Hosts interface, we can see the IP addresses of all our hosts, and click to copy them.

click to copy 

We can then navigate to that IP address in our web browser, and we’ll be presented with the Hello World landing page. Note that the IP address shown on the Hello World page is the internal, private IP of the host if you enabled private networking when spinning up the DigitalOcean hosts.

Hello world! 

To see the load balancer in action, we can spam the F5 key to refresh the page and see the hostname of the container change every once in a while as the network load is balanced across our hello-world containers.

That’s it! We’ve successfully bootstrapped Rancher 2.0, launched a few hosts, deployed a container as a global service, and deployed a set of load balancers as a global service. Stay tuned to see some more demonstrations of Rancher 2.0 and feel free to give us feedback on our user Slack in the channel #2-0-tech-preview, or on our forums.

If you want to clean up our services and hosts for your next project, I’ll demonstrate that below.

Cleaning Up Hosts in Rancher 2.0

Rancher 2.0 offers list views that make multi-selecting hosts and services a breeze, so cleaning up our stack can be done in only a few clicks.

First, head back to the Balancers tab, tick the box next to hello-lb, and then click Delete in the menu under the tabs.

Next, go back to the Containers tab and do the same with the hello-world service.

Finally, head on over to the Hosts page, select all current hosts, and click Delete.

Your Rancher 2.0 stack is now clean and ready for a new set of hosts, and a new project!

Eric Volpert is a student at the University of Chicago and works as an evangelist, growth hacker, and writer for our Rancher Labs. He enjoys any engineering challenge. He’s spent the last three summers as an internal tools engineer at Bloomberg and a year building DNS services for the Secure Domain Foundation with CrowdStrike. Eric enjoys many forms of music ranging from EDM to High Baroque, playing MOBAs and other action-packed games on his PC, and late-night hacking sessions, duct taping APIs together so he can make coffee with a voice command.

Free eBook: Continuous Integration and Deployment with Docker and Rancher

Supercharge your CI/CD Pipeline with Containers

Free eBook: CI/CD Pipelines with Docker and Rancher

Upcoming Events

Recent Posts