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?

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.

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

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.

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.

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.

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.

Deploying Containers on Rancher 2.0

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

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.

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.

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:

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.

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.

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

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:

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.

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.

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.

Join us for free online training courses, hosted monthly by a Rancher technical expert. We provide a great hands-on overview for new users setting up a Rancher deployment, and answer any and all questions you have about Rancher and how to integrate it into your DevOps processes!