Hello good people. This guide will cover the installation and usage of Rancher container management platform on Ubuntu LTS. Rancher is an open source, production ready, complete container management platform developed by Rancher Labs.

Rancher natively supports Kubernetes and allows users to control its features through a simple and intuitive UI. Kubernetes can be launched in a matter of minutes with a single click through Rancher. It integrates with LDAP, AD, and GitHub for authentication.

Rancher also provides Application catalog with over 90 popular Docker applications where you can deploy and manage complex applications with a click of a button. If you’re a Helm user, then no worry as Rancher ships with it. Additionally,  it’s easy to update Kubernetes to latest stable release using its Rancher UI.

Rancher installation on Ubuntu

Here is the installation process of Rancher on Ubuntu. After the installation, we will deploy a Kubernetes cluster and create a test application container.

This setup has two VMs we are using.

Rancher Node: 192.168.18.60
Worker Node:  192.168.18.61

Step 1: Install Docker Engine

As Rancher and all workloads run on Docker containers, you need to have docker engine installed on your server

Update system apt index:

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

Then install the latest release of docker from the repository

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker-archive-keyring.gpg
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

The install Docker Engine container runtime.

sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Wait for the download and installation of packages to finish then check docker version installed.

$ docker version
Client: Docker Engine - Community
 Version:           27.0.3
 API version:       1.46
 Go version:        go1.21.11
 Git commit:        7d4bcd8
 Built:             Sat Jun 29 00:02:23 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.0.3
  API version:      1.46 (minimum version 1.24)
  Go version:       go1.21.11
  Git commit:       662f78c
  Built:            Sat Jun 29 00:02:23 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.18
  GitCommit:        ae71819c4f5e67bb4d5ae76a6b735f29cc25774e
 runc:
  Version:          1.7.18
  GitCommit:        v1.1.13-0-g58aa920
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

You can also install an experimental release of docker using the script provided by Docker.

curl -fsSL get.docker.com -o get-docker.sh
chmod +x get-docker.sh
sudo ./get-docker.sh
sudo usermod -aG docker $USER

Step 2: Start Rancher container

Next, create a new Rancher server container by running the command:

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

If you have ports 80 & 443 used in your host system by other applications, you can map to different ports like below

sudo docker run -d --privileged \
 --restart=unless-stopped \
 -p 8080:80 \
 -p 8443:443 \
 --name rancher \
 rancher/rancher

Check status of the container using docker ps command:

$ docker ps
CONTAINER ID   IMAGE             COMMAND           CREATED         STATUS         PORTS                                                                      NAMES
efefef5aad09   rancher/rancher   "entrypoint.sh"   3 seconds ago   Up 2 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   rancher

Step 3: Access Rancher Web UI

Get the IP address or Hostname of your Rancher node:

ip ad
# OR
hostname -f

Get bootstrap password:

docker logs  rancher  2>&1 | grep "Bootstrap Password:"

Sample output from running the commands:

2024/07/14 13:51:07 [INFO] Bootstrap Password: rkfl7hjffwdvrwwfv7w7wplrcl4qxwmvt4x56cwj9jm9wkmcmsthkp

The Rancher user interface can be accessed at https://<server_ip>.

Enter password collected from running the docker logs command.

Install Rancher 01

Next change the password as instructed.

Install Rancher 02

You will then access Rancher Dashboard.

Install Rancher 03

Step 3: Create a Kubernetes Cluster

Here we’ll create a single node Kubernetes cluster, note that in a Production environment, you’ll need at least three nodes, one master node, and two worker nodes.

To create a new cluster, navigate to Cluster Management

Install Rancher 04

The click “Clusters” > “Create“.

Install Rancher 05

Here you have three options of creating a cluster:

  • Create a cluster in a hosted Kubernetes provider
  • Provision new nodes and create a cluster using RKE2/K3s
  • Use existing nodes and create a cluster using RKE2/K3s

Choose the appropriate option to deploy new cluster or import existing cluster and manage from Rancher Dashboard.

Further reading:

Refer to Rancher Documentations pages for how-to steps for cluster deployments and management.

Stay tuned for more articles related to Docker and Kubernetes.

LEAVE A REPLY

Please enter your comment!
Please enter your name here