Hi:wave:,
This repo contains bunch of scripts to get you easily up and running with Kubernetes + Rancher 2. It uses K3S, a lightweight variant of K8S developed by the rancher people. You can obviously install standard K8S - and still control it by Rancher 2. In such case ignore first 3 steps.
You should have:
- 1 VPS for running rancher 2, the k8s master node
- X VPS for running worker nodes
😲 for the cheapest setup, they can be the same node!
- On each node run
install-pkg.sh
to get necessary packages - On master node, run
install-k3s.sh
- Start k3s with
/usr/local/bin/k3s server
or/usr/local/bin/k3s server --docker
if yo usee containerd related errors. - On master node, set hostname in
/etc/hostname
. Make surehostname
prints the full hostname with domain name. - On master node, get LetsEncrypt certificate by calling
./certbot.sh [email protected]
- Run rancher
./rancher2.sh
. It will start rancher in a container and display logs. You can ctrl-C any time to stop output, it will not kill rancher. - Kill rancher with
./kill-rancher2.sh
- Open the host in your browser, you should see rancher
- Copy
k3s.service
to/etc/systemd/system
and enable itsystemctl enable k3s.service
- Your container runtime should also be enabled by default (containerd or docker)
- You might want to enable swap - see
create-swap.service
(A one time service to create a swap file) andswap.service
(enable swap on each boot)