rancher

Rancher management (local) cluster on single-node k3s with cert-manager.

Use it on boxctl

  1. On the dashboard, pick rancher in the Template picker and click Boot box.
  2. The box boots, then runs rancher/rancher-local.sh on itself. The button reads Booting… until the script has finished.
  3. Open the box's Terminal and follow the guide below. The box's row keeps a link back to this page under the template's name.

The guide is shared with the onctl CLI, so it starts from an onctl up -a rancher/rancher-local.sh command. Booting a box with this template replaces that command; everything the guide runs on the VM itself applies as written.

Options

boxctl cannot pass options to a template yet, so each of these keeps its default.

OptionRequiredWhat it sets
RANCHER_HOSTNAMENoDefault: rancher.<public-ip-with-dashes>.sslip.io.
RANCHER_VERSIONNoRancher chart version (default: latest).
RANCHER_REPLICASNoDefault: 1.
BOOTSTRAP_PASSWORDNoFirst admin password (default: random, saved to /root/rancher-bootstrap-password).
CERT_MANAGER_VERSIONNocert-manager chart version (default: latest).
K3S_VERSIONNoe.g. v1.35.4+k3s1 (default: k3s stable channel).

Rancher management (local) cluster on k3s

Creates a single-node k3s cluster and installs cert-manager and Rancher on it, so the VM becomes a Rancher management ("local") cluster that you can import or provision downstream clusters from.

onctl up -n rancher -a rancher/rancher-local.sh --download /root/rancher-info.txt
cat rancher-info.txt

rancher-info.txt contains the Rancher URL and the bootstrap password for the first login. You can also see it later with onctl ssh rancher and cat /root/rancher-info.txt.

With no variables set, the template uses these defaults:

  • URL: https://rancher.<public-ip-with-dashes>.sslip.io/. sslip.io resolves that name to the VM's IP, so you don't need a DNS record. Rancher requires a hostname and always serves its UI over HTTPS.
  • Certificate: self-signed, issued by cert-manager. Accept the browser warning.
  • Rancher: the latest version from the rancher-stable chart repo, with 1 replica.
  • Bootstrap password: random, saved to /root/rancher-bootstrap-password. Rancher asks you to change it at first login.

Use a VM with at least 2 vCPU and 4 GB of RAM (tested on Hetzner ccx13, 2 vCPU / 8 GB; ready in about 3 minutes).

Options

onctl up -n rancher -a rancher/rancher-local.sh \
  -e RANCHER_HOSTNAME=rancher.example.com \
  -e RANCHER_VERSION=2.15.2 \
  -e BOOTSTRAP_PASSWORD=change-me-now \
  -e K3S_VERSION=v1.35.4+k3s1
VariableDefaultDescription
RANCHER_HOSTNAMErancher.<ip>.sslip.ioHostname for the Rancher UI; point its DNS record at the VM if you change it
RANCHER_VERSIONlatest stableRancher chart version
RANCHER_REPLICAS1Rancher server replicas
BOOTSTRAP_PASSWORDrandomPassword for the first admin login
CERT_MANAGER_VERSIONlatestcert-manager chart version
K3S_VERSIONk3s stable channelk3s version; must be supported by the Rancher version

If the Rancher install fails with an incompatible kubeVersion, the latest k3s is newer than the Rancher release supports. Set K3S_VERSION to a supported version.

Kubeconfig

onctl up -n rancher -a rancher/rancher-local.sh --download /tmp/k3s.yaml
kubectl --kubeconfig k3s.yaml get po -A

The k3s token for adding nodes is in /tmp/token. Join nodes with k3s/k3s-agent.sh, as described in the k3s README.

See the template's source for exactly what it runs.