BoxBoat Blog

Service updates, customer stories, and tips and tricks for effective DevOps

Getting Started With Rancher

by Mike 'MJ' Johnson | Thursday, Aug 15, 2019 | Rancher Kubernetes

Getting Started With Rancher

Getting Started With Rancher

Kubernetes is all the rage these days. I can’t open my LinkedIn or Twitter page and not see some news about a new Kubernetes tool or managed service. And, in my opinion, rightly so. Kubernetes as a technology has provided organizations with an enterprise grade tool invented and promoted by Google themselves, open source and ready to use for the rest of us.

Unfortunately, with the power and flexibility of Kubernetes, you also get a massive amount of complexity. Even once the engineers are well versed in all of the terminology and technical inner workings of the system, the reality of the day-to-day management of multiple clusters is still daunting. So what can be done to make the management and monitoring of multiple K8s clusters viable?

Say ‘Howdy’ to Rancher

Rancher was founded in 2014 with a company focus on creating software to help manage Docker containers. They have since released a number of products including RancherOS, K3s, Project Longhorn, and others. Today, we will be focusing on how their product Rancher 2 can help you more easily deploy, manage and maintain your Kubernetes clusters across multiple environments, both on premise and in the cloud.

Per Rancher’s own description of the product:

“Rancher is a platform built to address the needs of the DevOps teams deploying applications with Kubernetes, and the IT staff responsible for delivering an enterprise-critical service.”

I think that sums up tool nicely. Let’s jump into how you can get a Rancher test environment up and running and see how it can potentially help your organization.

If you are looking to setup Rancher quickly and learn about its key features, you’ve come to the right place.

Related: BoxBoat Announces Platinum Partnership with Rancher

System Prep

Luckily, Rancher has made it extremely simple to stand up your first Rancher management node. Note earlier I said “test environment”. The process I am about to share is not an HA solution. If you intend to deploy Rancher into a production-like setting, I would highly recommend following the documentation here, or contact us for assistance.

Getting back to installation, the first thing you will need is a Linux machine running anything on the node requirements list. Make sure the machine has at least 4GB of memory or you are “gonna have a bad time.”

Next, you will need Docker installed. Not something I will cover here, but if you haven’t done this before, you can follow the official Docker instructions for your specific Linux distribution.

Lastly, navigate to the Rancher Quick Start documentation to get the single line container deployment command to get the Rancher 2 environment up and running. I have added a code snippet below, but please refer to official documentation often for any updates Rancher may have put out.

sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher

Once the Rancher container is up and running, navigate to the IP of your host machine where you installed Docker and open the browser to https://your-server-ip-or-dns-name

Please note that the install demo here is completely ephemeral. There are no mounted volumes or any sort of persistence and all changes and settings will be lost when you remove the Rancher container.

Quick Look Around

Upon initially visiting the Rancher page you will be prompted to set a password using the default user admin and then set a hostname. After that, you will be able to navigate through the interface and work with various pieces.

Rancher has done an excellent job of documenting all of the tools available as well as providing educational resources.

For now, let’s just add a cluster. In my example, I will use the Rancher interface to deploy a brand new Kubernetes cluster using Digital Ocean droplets. All you will need is an Access token and Rancher will guide you through the rest of the necessary options.

Add a DO Kubernetes Cluster

We can configure Rancher to communicate with Digital Ocean above.

Cluster Provisioning

And just like that, you have a Kubernete 1.14 cluster deployed on Digital Ocean with your own management interface provided by Rancher. But wait, there is more…

Cluster deployed and added to Rancher dashboard

Top 3 Initial Features of Rancher

For the ease of multi-cluster Kubernetes deployment and management alone, Rancher is well worth the time spent getting it up and running. But we haven’t even gotten to the best features for those looking to simplify Kubernetes management. Below are the 3 key features of Rancher that, based on my experience working with it in production, are the most valuable when just getting started:

1. Monitoring

Being able to observe what is going on at all times and the ability to easily spot trends and potential issues quickly is a critical piece to your tech staff being effective at their jobs(and being able to sleep at night). Rancher has us covered on this front.

If you are following along, navigate over to the your cluster name, Tools, and Monitoring section and you will see that Rancher allows you to create a full Prometheus based monitoring deployment with just a few clicks.

Configuring Prometheus monitoring for your Kubernetes cluster has never been easier.

Cluster deployed and added to Rancher dashboard

We can now see all of our cluster metrics and we are even able to drill down to a pod level to see what resources individual pods are using.

Cluster deployed and added to Rancher dashboard

We can see the Pod-level metrics below.

Cluster deployed and added to Rancher dashboard

Related: In-depth Prometheus Monitoring Walkthrough

2. Alerting

What good is monitoring if you always have to be watching the screen. None at all. You could dig in and configure alert-manager for Grafana, but, you don’t have to thanks to Ranchers inclusion of alerting thresholds and integrations with email, Slack and other communication channels.

Before enabling the alerts, we need to configure a notifier. Click on Tools, Notifier and then click Add Notifier and configure the destination you want.

Cluster deployed and added to Rancher dashboard

Now, let’s enable the alerts. Click Tools, Alerts. There are a number of preconfigured alerts that you can chose from, so lets just setup the one for etcd. Click the elipses on the left of the etcd section and choose edit. At the bottom, add the notifier you just created, click Save, and you are done!

Cluster deployed and added to Rancher dashboard

From that interface you can create any number of custom alerts that you would like notifications on.

3. Catalog Kubernetes Deployments

We recommend you use a CI/CD or GitOps approach to ensure having clear documentation for any apps you deploy or modify, but Rancher gives you an easy way to test deployments for either built in apps, stable/experimental Helm charts, or even provide access to your own custom Helm chart repo.

This is great for testing, and Rancher even gives you access to the YAML in case you are just looking for a starting place to write your own custom deployment files.

In this example, we will use the built in Rancher catalog, but by clicking on Global Tools Catalogs you can enable additional repos with a huge amount of apps available.

By clicking on my clustername, the Default project, and then Apps, I get a list of deployable catalog items from Rancher. In this example, I choose Wordpress, give it a name, and leave the rest of the options as their default. Rancher will automatically deploy Wordpress, a MySQL DB, and provision a xip.io DNS name for our new site.

Cluster deployed and added to Rancher dashboard

We can easily use the Rancher catalog to deploy an application, in this case WordPress.

Cluster deployed and added to Rancher dashboard

Final Words

Thanks for walking through this introduction to Rancher with me. We only covered a small fraction of how Rancher can help ease your Kubernetes cluster management efforts and aid in application deployments, but I hope you explore more and can see the value using Rancher can provide.

Please reach out to us at BoxBoat if you want to know more about how Rancher can help your organization accelerate Kubernetes adoption. In addition, we offer a Managed Kubernetes service called BoxOps that is built using Rancher and other open source tools. Your engineers can keep developing code, we’ll handle the rest from Continuous Integration all the way to production deployment and high availability.

BoxBoat Accelerator

Learn how to best introduce Kubernetes into your organization. Leave your name and email, and we'll get right back to you.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.