When I first started my Kubernetes journey, I was looking for the way to set up my local development environment, usually, most people find the minikube or microk8s, both are good starting point for a single node cluster environment. Once I had learnt the basic, I was looking for further — a local multi-node cluster, a more production-like environment. In aim to do this, I found many references which turn me to the cloud, the EKS, GKS, AKS, … but before I type in my credit card number, I found the Rancher Server, and I am going to tell you how to set up my local k8s multi-node cluster.

1. Prepare the VMs for master node and worker nodes

Above pic show my cluster layout, a single master node with three worker nodes, that mininal configuration allows me try out those cross-node features such as load-balancing with ingress controller, session affinity, host affinity, …

Rancher Server does not come with the complex installation, it is packaged as a docker image and can be run as a container. The basic configuration of a node is a docker CE daeon running on a linux VM, for my case, I pick Ubuntu 18.04 LTS (please refer to node requirements from Rancher doc). When I finished the first VM, I clone it to another three, and two more tips if your are doing the same:

Finally all four nodes were spinned up on my 10 year old PC (with i5 and 24G RAM), and they are assigned with following resource.

master node (2 core, 4G RAM, Ubuntu 18.04 + Docker CE 18.09) x 1

worker node (2 core, 3G RAM, Ubuntu 18.04 + Docker CE 18.09) x 3

2. Start the Rancher server on the master node

sudo docker run \

-d --name=rancher-master \

--restart=unless-stopped \

-p 81:80 -p 444:443 \

rancher/rancher

Above command for start the Rancher server container, and I run it on the master node. By default, nginx ingress controller is embedded in the worker node and it bind to port 80 and 443, that’s why I published the rancher server to port 81 and 444 or other ports to avoid port conflict.

3. Complete the Rancher server initial setup