Install k3s and rancher on ubuntu VM

In this tutorial i will  demonstrate how to first install k3s and then install rancher on that k3s.

Prerequisites:

  • A virtual machine.
  • HELM installed

     

Install k3s.

     NOTE: i am installing the “v1.25.10-rc1+k3s1” version cuz at that time this is the newest allowed for using latest rancher.

curl https://get.k3s.io | INSTALL_K3S_VERSION=v1.25.10-rc1+k3s1 sh - 

Install CRD’s

kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.5.1/cert-manager.crds.yaml

Add the Jetstack HELM repository and update local chart repository cache

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

Install the cert manager HELM chart

helm install cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --create-namespace \
  --version v1.5.1

Install RANCHER

  1. add rancher stable repository and update
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable && helm repo update

        2. install the charts

            The ” –set global.cattle.psp.enabled=false” required to get rid of the following error:

            Error: INSTALLATION FAILED: execution error at (rancher/templates/validate-psp-install.yaml:4:5): The target cluster does not have the PodSecurityPolicy API resource. Please disable PSPs in this chart before proceeding.
REF: https://github.com/rancher/rancher/issues/41295

            “–set hostname=rancher.local” add a relevant value to your hosts file.

helm install rancher rancher-stable/rancher \
  --namespace=cattle-system \
  --create-namespace \
  --set hostname=rancher.local \
  --set replicas=3 \
  --set bootstrapPassword=admin \
  --set global.cattle.psp.enabled=false

And then after a couple of minutes you will be able to load the following URL and start the journey…

https://rancher.local

And thats about it….