Rancher
Rancher
Prerequisites
Before starting, ensure you have:
- 4+ Virtual Machines (VMs) running Ubuntu
Rancher Setup Walkthrough
1. Prepare Rancher Host
Login to your designated Rancher management VM. This should be a separate node from your K3s cluster.
2. Docker Installation (Optional)
For systems requiring container runtime:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# Install Docker components:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify installation:
1
docker -v && docker compose version
Rancher Deployment
1. Docker Compose Configuration
Create docker-compose.yml with:
1
2
3
4
5
6
7
8
9
10
11
services:
rancher:
image: rancher/rancher:v2.10.2
restart: unless-stopped
container_name: rancher
ports:
- "80:80/tcp"
- "443:443/tcp"
volumes:
- "./rancher-data:/var/lib/rancher"
privileged: true
2. Launch Rancher
Start the container stack:
1
sudo docker compose up -d
Rancher Initial Configuration
1. Access Web UI
Navigate to https://<your-vm-ip> in your browser
2. Retrieve Bootstrap Password
Get initial credentials:
1
sudo docker logs rancher 2>&1 | grep "Bootstrap Password:"
3. Cluster Creation
- From dashboard, click
Create Cluster - Select
Customcluster type - Configure options:
- Kubernetes Version: k3s latest
- Disable unnecessary services (e.g., Traefik)
- Click
Create
Node Management
1. Add Cluster Nodes
- Navigate to cluster’s
Registrationtab - Select
Insecureregistration method - Copy registration command
- Execute command on each worker node
2. Monitor Node Joining
Check node status in Machines tab. Allow 5-10 minutes for full provisioning.
Import Existing K3s Cluster
1. Cluster Import
- From Home, click
Import Existing - Select
Genericprovider - Name your cluster and click
Create
2. Registration Command
Copy and execute the provided command on your existing K3s master node:
1
kubectl apply -f https://<rancher-server>/v3/import/<cluster-id>.yaml
Verification & Testing
Confirm successful setup:
- Check all nodes show “Active” status
- Verify cluster health in Rancher dashboard
- Test workload deployment through Rancher UI
🎉 Congratulations! You’ve successfully deployed Rancher management platform and integrated K3s clusters!
Maintenance Tips
- Regularly back up rancher-data volume
- Monitor certificate expiration dates
- Keep Rancher updated to latest stable version
Useful References
This post is licensed under
CC BY 4.0
by the author.