Skip to content

Instantly share code, notes, and snippets.

@DylenTurnbull
Last active April 11, 2022 15:45
Show Gist options
  • Save DylenTurnbull/4d1bc364cd5e7a692e1fa2971e939a0f to your computer and use it in GitHub Desktop.
Save DylenTurnbull/4d1bc364cd5e7a692e1fa2971e939a0f to your computer and use it in GitHub Desktop.

Rancher Primer

Dev Environment setup

This is a minimal set of tools, recomended to make life a bit more simple to get started. If you have a preferred way of doing this as we all do by all means please do. The one common tool that bootstrapping the clusters heavily relies on is Rancher Desktop, it is strongly recommended that this be used to follow along.

Windows

MS Store (Optional)

Install Windows Terminal

Install WSL from terminal with admin

wsl --install

Tools Installation

Mac

Tools Installation

Linux

Tools Installation

Introduction to Rancher Manager

This will set up a local Rancher Manager in HA running on your newly created K3s instance.

Adding the required Helm repos

helm repo add jetstack https://charts.jetstack.io
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
helm repo update

Adding NGINX ingress controller

helm install nginx-ingress nginx-stable/nginx-ingress \
  --namespace kube-system \
  --set prometheus.create=true \
  --set controller.kind=daemonset

Adding CRDs for JetStack (cert managment)

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

Installing JetStack via Helm

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

Installing Rancher Manager via Helm

kubectl create namespace cattle-system
helm install rancher rancher-stable/rancher \
  --namespace cattle-system \
  --set hostname=rancher.my.org \
  --set replicas=3

Accessing the local HA Rancher Manager

  • Edit local host file to add the host name you picked above
  • open this host name in a browser

Rancher RKE 2 installation

Installation Steps

  1. Stand up either an Unbuntu 20.04 lts or a SUSE Leap 15.3 VM.
  2. See Requirements here RKE 2 Node requirements
  3. Change the ipaddress and host name your desired values.
  4. Run the following commands from the Quick Start Guide

Control Plane Node Install

curl -sfL https://get.rke2.io | sh -
systemctl enable rke2-server.service
systemctl start rke2-server.service

Copy the Kube config from the racnher CP node

scp [email protected]:/etc/rancher/rke2/rke2.yaml  /mnt/c/Users/dylen/.kube/rke2.yaml

Get the CP node token using the command below

cat /var/lib/rancher/rke2/server/node-token

Worker Node Install

curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE="agent" sh -
systemctl enable rke2-agent.service

Edit config.yaml to add the worker node to the cluster

mkdir -p /etc/rancher/rke2/
vim /etc/rancher/rke2/config.yaml
server: https://<server>:9345
token: <token from server node>
systemctl start rke2-agent.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment