In the previous posts, we set the stage with hardware and VM provisioning. Now it’s time to get Kubernetes up and running. We’re using k3s for its lightweight footprint and ease of use—perfect for a homelab.
Step 1: Install k3s on the First Node (cube1)
On cube1
(10.0.0.16), run the following:
curl -sfL https://get.k3s.io | sh -
This installs k3s and sets up cube1
as the control plane. Once complete, verify with:
sudo kubectl get nodes
Copy the kubeconfig to your jumpbox for remote management:
sudo cat /etc/rancher/k3s/k3s.yaml
Edit the server
IP inside the file to 10.0.0.16
and copy it over to your jumpbox at ~/.kube/config
.
Step 2: Join Worker Nodes (cube2 and cube3)
On cube1
, get the token:
sudo cat /var/lib/rancher/k3s/server/node-token
Then SSH into cube2
and cube3
and run:
curl -sfL https://get.k3s.io | K3S_URL=https://10.0.0.16:6443 K3S_TOKEN=<token> sh -
Replace <token>
with the actual token string.
Step 3: Verify the Cluster
Back on your jumpbox:
kubectl get nodes
You should see all three nodes listed.
Step 4: Install MetalLB
MetalLB provides LoadBalancer functionality in a bare-metal environment.
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.10/config/manifests/metallb-native.yaml
Wait a moment and verify that MetalLB pods are running:
kubectl get pods -n metallb-system
Step 5: Configure the Address Pool
Create a MetalLB config with your IP range. We’ll use 10.0.0.25–10.0.0.49:
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: home-pool
namespace: metallb-system
spec:
addresses:
- 10.0.0.25-10.0.0.49
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: home-l2
namespace: metallb-system
Save that as metallb-config.yaml
and apply it:
kubectl apply -f metallb-config.yaml
What’s Next?
With k3s and MetalLB up, the next step is persistent storage. In Post 4, we’ll install Longhorn to handle application and configuration storage across nodes.
Tip: Keep your YAMLs version-controlled in a Git repo. It makes it easier to rollback and replicate your setup later.
Let’s keep going and get this homelab humming!