How to Install Rancher Kubernetes Panel on Ubuntu 22.04

Rancher is a free, open-source, and multi-cluster orchestration platform that allows organizations to deploy containers in a production environment. It allows you to streamline cluster deployment on bare metal, private clouds, public clouds, or vSphere and secure them using global security policies. Using this container management platform, you can deploy, manage and run Kubernetes everywhere.

Features of Rancher

  • Cross-host networking
  • Container load balancing
  • Persistent Storage Services
  • Service discovery
  • Service upgrades
  • Resource management
  • Multi-tenancy & user management
  • Multi Orchestration Engines

This tutorial will show you how to install the Rancher Kubernetes container management platform on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • Minimum 4 GB of RAM.
  • A root password is configured on the server.

Getting Started

Before starting, it is a good idea to update and upgrade all system packages to the latest version. You can update all of them by running the following command:

apt update
apt upgrade

Once all the packages are updated, you can proceed to the next step.

Install Docker CE

First, you will need to install the Docker CE on your server. By default, the latest version of Docker CE is available in the Ubuntu 22.04 default repository. You can install it with the following command:

apt install docker.io -y

Once the Docker CE is installed, verify the Docker version using the following command:

docker version

You should see the following output:

Client:
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.17.3
 Git commit:        20.10.12-0ubuntu4
 Built:             Mon Mar  7 17:10:06 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.3
  Git commit:       20.10.12-0ubuntu4
  Built:            Mon Mar  7 15:57:50 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.5.9-0ubuntu3
  GitCommit:        
 runc:
  Version:          1.1.0-0ubuntu1
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        

Once you are finished, you can proceed to the next step.

Manage Docker Services

By default, the Docker service is managed by systemd. You can manage it easily using the systemctl command.

To start the Docker service and enable it to start at system reboot, run the following command:

systemctl start docker
systemctl enable docker

You can also check the status of the Docker with the following command:

systemctl status docker

You should see the following output:

? docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-07-24 05:09:45 UTC; 24s ago
TriggeredBy: ? docker.socket
       Docs: https://docs.docker.com
   Main PID: 115654 (dockerd)
      Tasks: 7
     Memory: 30.5M
        CPU: 356ms
     CGroup: /system.slice/docker.service
             ??115654 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Jul 24 05:09:45 ubuntu dockerd[115654]: time="2022-07-24T05:09:45.440732558Z" level=info msg="scheme \"unix\" not registered, fallback to def>
Jul 24 05:09:45 ubuntu dockerd[115654]: time="2022-07-24T05:09:45.440869430Z" level=info msg="ccResolverWrapper: sending update to cc: {[{uni>
Jul 24 05:09:45 ubuntu dockerd[115654]: time="2022-07-24T05:09:45.440999011Z" level=info msg="ClientConn switching balancer to \"pick_first\">
Jul 24 05:09:45 ubuntu dockerd[115654]: time="2022-07-24T05:09:45.493588262Z" level=info msg="Loading containers: start."
Jul 24 05:09:45 ubuntu dockerd[115654]: time="2022-07-24T05:09:45.728082693Z" level=info msg="Default bridge (docker0) is assigned with an IP>
Jul 24 05:09:45 ubuntu dockerd[115654]: time="2022-07-24T05:09:45.888415790Z" level=info msg="Loading containers: done."
Jul 24 05:09:45 ubuntu dockerd[115654]: time="2022-07-24T05:09:45.919227724Z" level=info msg="Docker daemon" commit=20.10.12-0ubuntu4 graphdr>
Jul 24 05:09:45 ubuntu dockerd[115654]: time="2022-07-24T05:09:45.919727905Z" level=info msg="Daemon has completed initialization"
Jul 24 05:09:45 ubuntu systemd[1]: Started Docker Application Container Engine.

Once you are finished, you can proceed to the next step.

Install Rancher Ubuntu 22.04

At this point, Docker is installed on your system. You can now run the following command to download and launch the Rancher container.

docker run -d --name=rancher-server --restart=unless-stopped -p 80:80 -p 443:443 --privileged rancher/rancher:v2.4.18

You should see the following output:

Unable to find image 'rancher/rancher:v2.4.18' locally
v2.4.18: Pulling from rancher/rancher
11323ed2c653: Pull complete 
b7dc5ddb9fe7: Pull complete 
0372c040ea0d: Pull complete 
5a7eaf28cae2: Pull complete 
0d1eff5b3c25: Pull complete 
041282f2e586: Pull complete 
7cc8371df882: Pull complete 
3150273d5f70: Pull complete 
afc5be66b12f: Pull complete 
178a32bc5aa3: Pull complete 
54d219a8d26f: Pull complete 
ea3ba9f14df5: Pull complete 
a97b83c715bd: Pull complete 
a895bd7633e7: Pull complete 
516c02ccca88: Pull complete 
dcb1f2890247: Pull complete 
Digest: sha256:69a7403fb9fe5fe0e58c5a5ff94d04e2ca74d7fce6ed7f29a5c04311ba14cc79
Status: Downloaded newer image for rancher/rancher:v2.4.18
51405105eee8eed48dcaf7589ef253295275c941fc3963a2ca9e9c43d844b410

The above command will download the Rancher image from the Docker Hub registry and create a container from it. You can see the downloaded image using the following command:

docker images

You should see the following output:

REPOSITORY        TAG       IMAGE ID       CREATED        SIZE
rancher/rancher   v2.4.18   da1ad4a1e248   3 months ago   890MB

You can also verify the running container using the following command:

docker ps

You should see the Rancher container in the following output:

CONTAINER ID   IMAGE                     COMMAND           CREATED          STATUS          PORTS                                                                      NAMES
2d32d612b497   rancher/rancher:v2.4.18   "entrypoint.sh"   23 seconds ago   Up 21 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   rancher-server

Once you are finished, you can proceed to the next step.

Access Rancher Web Interface

At this point, Rancher is installed and listens on port 443. You can now access it using the URL https://your-server-ip. You will be redirected to the Rancher welcome screen:

Set your admin password and click on the Continue button. You should see the following screen:

Define your server URL and click on the Save URL button. You should see the following screen:

Allow collection of anonymous information and click on the Got it button. You should see the Rancher dashboard on the following screen:

Manage Rancher Container

You can also see the Rancher logs using the following command:

docker container logs rancher-server

You should see the following output:

2022/07/24 05:13:27 [INFO] kontainerdriver azurekubernetesservice listening on address 127.0.0.1:39997
2022/07/24 05:13:27 [INFO] kontainerdriver azurekubernetesservice stopped
2022/07/24 05:13:27 [INFO] dynamic schema for kontainerdriver azurekubernetesservice updating
2022/07/24 05:14:15 [INFO] Catalog-cache removed 2 entries from disk
2022/07/24 05:14:40 [INFO] Updating TLS secret for serving-cert (count: 4): map[listener.cattle.io/cn-127.0.0.1:127.0.0.1 listener.cattle.io/cn-172.17.0.2:172.17.0.2 listener.cattle.io/cn-localhost:localhost listener.cattle.io/cn-syspass.example.com:syspass.example.com listener.cattle.io/hash:e7ccf1ee0884f026725549817c91f5797ccfd133a810b5bd9c7446e03fa9383f]
2022/07/24 05:14:40 [INFO] Active TLS secret serving-cert (ver=2125) (count 4): map[listener.cattle.io/cn-127.0.0.1:127.0.0.1 listener.cattle.io/cn-172.17.0.2:172.17.0.2 listener.cattle.io/cn-localhost:localhost listener.cattle.io/cn-syspass.example.com:syspass.example.com listener.cattle.io/hash:e7ccf1ee0884f026725549817c91f5797ccfd133a810b5bd9c7446e03fa9383f]
2022/07/24 05:14:40 [INFO] Active TLS secret serving-cert (ver=2125) (count 4): map[listener.cattle.io/cn-127.0.0.1:127.0.0.1 listener.cattle.io/cn-172.17.0.2:172.17.0.2 listener.cattle.io/cn-localhost:localhost listener.cattle.io/cn-syspass.example.com:syspass.example.com listener.cattle.io/hash:e7ccf1ee0884f026725549817c91f5797ccfd133a810b5bd9c7446e03fa9383f]
I0724 05:18:41.035933      22 controller.go:606] quota admission added evaluator for: preferences.management.cattle.io
2022/07/24 05:19:08 [INFO] Creating token for user user-jb9gv
time="2022-07-24 05:19:08" level=info msg="Telemetry Client v0.5.14"
time="2022-07-24 05:19:08" level=info msg="Listening on 0.0.0.0:8114"
time="2022-07-24 05:19:08" level=info msg="Collecting anonymous data from https://localhost:443/v3"

To stop the Rancher container, run the following command:

docker container stop rancher-server

To start the Rancher container, run the following command:

docker container start rancher-server

To pause the Rancher container, run the following command:

docker container pause rancher-server

To remove the Rancher container, run the following command:

docker container remove rancher-server

Conclusion

In this post, we explained how to install Rancher on Ubuntu 22.04. You can now import your Kubernetes clusters or create a new container from the Rancher dashboard and manage all of them from the central location. Feel free to ask me if you have any questions.

Share this page:

0 Comment(s)