Step 1: Add Rancher Repo into Helm

Source: https:// rancher.com/docs/rancher/v2.x/en/installation/install-rancher-on-k8s/

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

# Create a namespace for Rancher
kubectl create namespace cattle-system

Step 2: Install CertManager

# Install the CustomResourceDefinition resources separately
kubectl apply --validate=false -f https://objects.githubusercontent.com/github-production-release-asset-2e65be/92313258/189a0000-1a00-11eb-866a-fa30b21c202a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20241004%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241004T140931Z&X-Amz-Expires=300&X-Amz-Signature=df5b10797cec88d33e5cdeb606060cff57c3d30d0708af2c302224ba32c9e18f&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Dcert-manager.crds.yaml&response-content-type=application%2Foctet-stream

# Create the namespace for cert-manager
kubectl create namespace cert-manager

# Add the Jetstack Helm repository
helm repo add jetstack https://charts.jetstack.io

# Update your local Helm chart repository cache
helm repo update

# Install the cert-manager Helm chart
helm install \
  cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --version v1.0.4

Step 3: Install Rancher

hostname=rancher.kimconnect.com
helm install rancher rancher-stable/rancher \
  --namespace cattle-system \
  --set hostname=$hostname

# Ran into this problem
Error: chart requires kubeVersion: < 1.20.0-0 which is incompatible with Kubernetes v1.20.2

# Workaround: Install K3s instead of K8s
curl -sfL https://get.k3s.io | sh -
# OR
curl https://get.k3s.io | INSTALL_K3S_VERSION=v1.19.7+k3s1 sh - # Install a specific version