While most Kubernetes deployments I do in my job are with Tanzu (or to be more specific TKGs) sometimes you need something a bit lighter and easier to setup for testing purposes in the Homelab.
While Tanzu is great and certainly offers more flexibility and more functionality than Rancher does out of the box, it requires much more setup work and has a bigger footprint for even setting up a simple cluster. And while I'm still working on my nested Tanzu Homelab solution (as you may have noticed...) in the meantime I have used Rancher for my testing use.
Feature overview
Setting up Kubernetes just for the API would be even more simple with just using MiniKube, K3S or even K8S in one or a few VMs. But where are you storing your PVs? How is the Networking and LoadBalancing done? Are you using Longhorn, HAProxy or anything else? And what if you need a second cluster?
Without going into any marketing slides here (as this is supposed to be a quick and dirty Homelab solution) here is what I like about Rancher:
- Easy cluster startup and management
- Native Helm integration (with an appstore)
- Helm values management through GUI
- vSphere CSI integration
- 100% opensource and free community edition
- Support for multiple providers such as EKS, AKS and GKS but also vSphere, Linode and many more in the cloud or on-prem
- RKE2 and K3S kubernetes cluster support (more on that later)
How to get started
Now how do you actually get started with Rancher? The easiest version is to just run in on docker and not really caring about it that much. After all, it is just a lab and so it shouldn't matter that much if it goes down or you need to redeploy it.
In this case the setup is simple: Setup a Linux VM or a physical host with at least 4GB of memory and any supported OS (any SUSE offering, Rocky, RHEL, Oracle or Ubuntu released in the last 2 years) and install Docker v26 (or v25). As of writing Rancher 2.9 has just released with support for Docker v26 so that's what we will be using. For your usecase please refer to https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/rancher-v2-9 to make sure you have the right version. For the example below I am using Ubuntu.
Install Docker
So because this is only a test deployment (right?) just install Docker with the default install settings recommended by Docker. So first, remove any packages that might be still there and conflicting:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
Then install the repository. You could in theory use the package that is supplied in the Ubuntu repository (if you use Ubuntu) but this is not updated as frequently and currently still using Docker v24.
# Add Key for repo:
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 Docker DEB repository:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Now, it should work with other versions as well, but because Rancher specifically asks for Docker v26, we install this. Therefore we need to list the available versions:
apt-cache madison docker-ce | awk '{ print $3 }'
# Output: you will get more versions, I shortened it here a bit
5:27.0.2-1~ubuntu.24.04~noble
5:27.0.1-1~ubuntu.24.04~noble
5:26.1.4-1~ubuntu.24.04~noble
So we need to select the newest V26 version like this:
VERSION_STRING=5:26.1.4-1~ubuntu.24.04~noble
And install it:
sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin
Verify that you have the correct version by running docker --version
You will notice, that you might not be able to run Docker commands on your current user, but only with sudo or with the root account. This is not ideal but can easily be solved by running the following commands:
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
This creates a new group (if it not already exists) with the name "docker" and adds your current user to it. Then it activates the group changes. Alternatively you could also relogin to bash. Try it by running docker run hello-world
.
Run Rancher
Now to running Rancher. We could go with a compose file or anything like that, but as I said, this is a test so just running the container with just the appropriate port forwarded (443 and 80 for WebUI) is sufficient. Simply run the following command:
sudo docker run --privileged -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher
Now connect to the IP of the server on port 443 (and accept the certificate warning as this installs a self-signed certificate).
In the next Part of this series I'll explain how to actually log in to the Rancher UI and how to deploy your first Kubernetes Cluster on vSphere. Later we will explore options to get the Rancher UI on Kubernetes itself and how to run it with high availability.