Operations 7 min read

How to Install Rancher 2.6.9 and Deploy a Kubernetes Cluster on Ubuntu

This step‑by‑step guide shows how to prepare two Ubuntu 22.04 servers, configure Docker and system settings, install Rancher 2.6.9 via Docker, and use Rancher’s UI to create and launch a functional Kubernetes master‑node and worker‑node cluster.

Raymond Ops
Raymond Ops
Raymond Ops
How to Install Rancher 2.6.9 and Deploy a Kubernetes Cluster on Ubuntu

Environment

Ubuntu 22.04.2 LTS

Docker 24.0.2

2 GB RAM or more

CPU 2 cores or more

Rancher 2.6.9

Two Ubuntu servers (192.168.10.43 and 192.168.10.42) are prepared: one as the Kubernetes master node, the other as a worker node. Time synchronization between the servers is required.

Pre‑operations

Change hostnames

Kubernetes does not allow duplicate hostnames, so set unique names: hostnamectl set-hostname master-1 on 192.168.10.43 and

hostnamectl set-hostname node-1

Disable swap

Swap must be disabled for Kubernetes to run correctly:

sed -ri 's/.swap./#&/' /etc/fstab

Configure Docker registry mirrors

Edit /etc/docker/daemon.json (create the file if it does not exist) with the following content:

{
    "registry-mirrors": [
        "https://ung2thfc.mirror.aliyuncs.com",
        "https://registry.docker-cn.com",
        "http://hub-mirror.c.163.com",
        "https://docker.mirrors.ustc.edu.cn"
    ]
}

Restart Docker to apply the configuration: systemctl restart docker Optionally reboot the servers to ensure all changes take effect.

Install Rancher

Rancher is a UI management layer for Kubernetes. Deploy it with Docker on the master host (192.168.10.43):

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

Monitor the installation progress: docker logs --tail 30 -f rancher When the container is ready, open http://<IP> in a browser to see the Rancher UI.

Rancher UI login page
Rancher UI login page

Retrieve the initial admin password:

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

After logging in, proceed to create a Kubernetes cluster.

Install Kubernetes via Rancher

In the Rancher UI, create a new cluster and choose the "Custom" option. Give the cluster a name and accept the default settings.

Create cluster screen
Create cluster screen

Select the components for the master node (Etcd and Control Plane). Rancher generates a docker run command; execute it on the master host (192.168.10.43) to deploy the master node. Repeat the generated command on additional hosts if multiple masters are needed.

For worker nodes, deselect Etcd and Control Plane, then run the provided docker run command on each worker host (e.g., 192.168.10.42).

Worker node deployment
Worker node deployment

After the containers are up, the cluster will show one master and one worker node:

Cluster node overview
Cluster node overview

Test the cluster

Create a simple Nginx deployment via the Rancher UI, expose port 80, and then access http://<IP>:30080 in a browser to see the Nginx welcome page.

Nginx deployment screen
Nginx deployment screen

The guide covers environment preparation, system configuration, Rancher installation, Kubernetes cluster creation, and a basic workload test.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerCluster DeploymentUbunturancher
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.