Deploying Ranger on Microk8s (on WSL2) with metallb and traefik

I am running Windows 11, and have enabled WSL2 with Ubuntu and Microk8s. This will deploy Rancher.

Install microk8s plugins and correct privileges

microk8s.enable dns storage traefik helm3 metallb

Allow running priviledged Pods (required by Rancher’s cattle-node-agent)

sudo sh -c 'echo "--allow-privileged=true" /var/snap/microk8s/current/args/kube-apiserver'


sudo systemctl restart snap.microk8s.daemon-apiserver.service

Check the pods

microk8s.kubectl get pods --all-namespaces

Install cert-manager

microk8s.kubectl apply --validate=false -f
microk8s.kubectl create namespace cert-manager
microk8s.helm3 repo add jetstack
microk8s.helm3 repo update
microk8s.helm3 install \
  cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --version v1.0.4

Install Rancher

microk8s.kubectl create namespace cattle-system
microk8s.helm3 install rancher rancher-latest/rancher \
  --namespace cattle-system \
  --set \
  --set replicas=1

Wait for it to be ready:

microk8s.kubectl -n cattle-system rollout status deploy/rancher

Expose Rancher

microk8s.kubectl expose deployment rancher -n cattle-system --type=LoadBalancer --name=rancher-lb --port=443

Get details:

microk8s.kubectl get svc -n cattle-system -o wide