High Availability Rancher on Kubernetes

Are you running Kubernetes in your homelab or in the enterprise? Do you want an easy way to manage and create Kubernetes clusters? Join me as we walk through installing Rancher on an existing high availability k3s cluster in this step-by-step tutorial.

We install Rancher, configure a load balancer, install and configure helm, install cert-manager, configure Rancher, walk through the GUI, scale up our cluster, and set up a health check and liveness check! Join me, it’s easy in this straightforward guide.

install helm

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

add helm repo, stable

helm repo add rancher-stable https://releases.rancher.com/server-charts/stable

create rancher namespace

kubectl create namespace cattle-system

ssl configuration

user rancher generated (default)

install cert-manager

kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.7.1/cert-manager.crds.yaml

create name-space for cert-manager

kubectl create namespace cert-manager

Add the Jetstack Helm repository

helm repo add jetstack https://charts.jetstack.io 

update helm repo

helm repo update 

install cert-manager helm chart

*Note: If you receive an “Error: Kubernetes cluster unreachable” message when installing cert-manager, try copying

the contents of “/etc/rancher/k3s/k3s.yaml” to “~/.kube/config” to resolve the issue.*

helm install cert-manager jetstack/cert-manager --namespace cert-manager --version v1.7.1

check rollout of cert-manager

kubectl get pods --namespace cert-manager

Be sure each pod is fully running before proceeding

Install Rancher with Helm

Note:If you have “.local” for your private TLD then Rancher will NOT finish the setup within the webUI

helm install rancher rancher-stable/rancher --namespace cattle-system --set hostname=rancher.xpdrive.cloud

check rollout

kubectl -n cattle-system rollout status deploy/rancher

you should see

Waiting for deployment "rancher" rollout to finish: 0 of 3 updated replicas are available...

Waiting for deployment "rancher" rollout to finish: 1 of 3 updated replicas are available...

Waiting for deployment "rancher" rollout to finish: 2 of 3 updated replicas are available...

deployment "rancher" successfully rolled out

check status

kubectl -n cattle-system rollout status deploy/rancher

you should see

deployment "rancher" successfully rolled out 

 

Exposing Rancher directly to your Metal LB

It’s a good idea to do this until traefik is configured otherwise you won’t have access to the Rancher UI 

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

Then, you can access Rancher UI after getting external-IP  

kubectl get service/rancher-lb -n cattle-system

Important Requirements

To be able to use RWX volumes, each client node needs to have a NFSv4 client installed.

For Ubuntu you can install a NFSv4 client via:

 apt install nfs-common 

For RPM based distros you can install a NFSv4 client via:

yum install nfs-utils

You can also install with ansible using my ansible playbook:

ansible-playbook ./playbooks/nfs.yml -i ./inventory/my-cluster/hosts.ini --ask-pass --ask-become-pass

Get In Touch

Get in touch with me about work opportunities


HIRE ME

Quick Links

Extras

Social Media Links

Copyright © Mark Clarke, 2022