Multipass Rancher is a quick set up script that can be used to create a functional Rancher lab for Linux or macOS environments via Ubuntu Multipass.
The following are the hardware and software prerequisites for common deployments:
- Sufficient CPU and memory resources to account for the K3s nodes (server and agents). Note: This can be customized (see below)
- Recent or latest release of Ubuntu Multipass installed
- Knowledge on how to import and trust Rancher-generated SSL certs
Multipass Rancher simplifies the creation of a custom-sized K3s cluster, including the Linux nodes that the cluster runs on. The script performs the following steps:
- Captures the desired number/amount of CPUs, memory, and disk space for each K3s agent node based on user input upon running the script.
- Creates the K3s server node with a predefined node definition and deploys K3s to it.
- Captures key information about the K3s server node, such as IP and K3s join token.
- Creates the desired number of K3s agent node(s) and installs K3s on them, joining them to the cluster.
- Installs Helm on the K3s server node.
- Installs
cert-managerandranchercharts via Helm.
The Rancher installation will automatically manage the K3s cluster that it is deployed to. No need to import it post-installation.
You can then leverage Rancher to deploy or manage additional Kubernetes clusters, including Rancher-launched clusters (i.e., RKE or EKS/AKS/GKE managed clusters) or import any existing Kubernetes cluster created outside of Rancher.
Note: The K3s cluster is for lab or non-production use only. It is not hardened for production use and does not include appropriate levels of high-availability for production use.
Usage:
./multipass-rancher-install.sh -w <num_agents> -c <num_cpus> -m <mem_size> -d <disk_size
Example:
./multipass-rancher-install.sh -w 3 -c 2 -m 4096 -d 20
The example above will create the following:
- A K3s cluster comprised of one (1) server node and (3) agent nodes
- Each agent node will be configured with 2 vCPU and 4GB of RAM, and a 20GB virtual disk
The following are some of the included components:
- The K3s nodes will be based on the latest Ubuntu 20.04 LTS (Focal Fossa) build available from Canonical.
- The K3s version itself will be the latest stable version.
- Rancher will be based on the
latestchannel, so you have the latest and greatest features...even experimental ones. - Certificate Manager is based on v1.2.0, which requires Kubernetes v1.16 or newer. As of 28 MAR 2021, the latest stable release was v1.20.4+k3s1; however, your build may be newer but definitely not older.
- Improve (or basically "add") error handling
- Add support for advanced K3s server and agent customizations
- Add support for the K3s automated upgrade controller
This script is governed under the MIT license.