Grab the bull by the horns: Rancher 2.3a
Rancher have long been a peripheral player in the container space for me. There has not been any crossroads where we’d meet and share war stories or joint opportunities. Recently I’ve become an indirect fan boi by admiring their two recent projects K3s and Submariner. I’ve known a while the that their homegrown orchestrator (Cattle) was getting an makeover in favor of Kubernetes. So, what is this Rancher thing about and what can it do besides moo I've started asking myself?
Based on what I’ve read and seen up to prior to installing (I’ve attended a few webinars) is that Rancher 2.x itself is an application that manages not only the cluster it runs in but also provisions and manages other clusters, including managed Kubernetes services such as GKE, AKS and EKS. It’s also light on the requirements side of things, all it needs is a supported version of Docker. All the way back to Docker 1.13.1 for vendor supported Docker from Red Hat which I have installed in my lab.
Given the minuscule host requirements, Rancher also has it’s own purposed built Linux distribution called RancherOS (Not to be confused with Huevos Rancheros). I have not had a chance to take RancherOS for a spin yet as my POC is based on Red Hat. Rancher recently launched another Kubernetes project that tangents to RancherOS called k3OS, which promises a running k3s cluster up and running in under 10 seconds (mind blown...). This I definitely want to take for a spin!
Now, the task at hand here is to deploy Rancher in an HA configration and have Rancher deploy another cluster for my applications. I didn’t have a compatible IaaS provider in my lab so I just provisioned a handful of KVM VMs and installed a supported version of Docker on them (from the Red Hat extras repo). Installing with the HA option cobbles together a Kubernetes cluster based on the Rancher Kubernetes Engine (RKE). RKE has a simple CLI utility where you simply declare your cluster in a YAML file and run rke up. Thats. It. For reference:
--- nodes: - address: tme-lnx7-taco user: mmattsson role: [controlplane,worker,etcd] - address: tme-lnx8-taco user: mmattsson role: [controlplane,worker,etcd] - address: tme-lnx9-taco user: mmattsson role: [controlplane,worker,etcd] services: etcd: snapshot: true creation: 6h retention: 24h
What you might squint at here is the fact that I’m squishing control plane, workers and the etcd cluster on the same set of nodes. That’s perfectly fine in this case as I won’t run any workloads on this cluster besides Rancher. Very modestly configured VMs with 8 vCPU, 120GB of disk and 8GB of RAM.
The RKE installer will spit out a kubeconfig in your current directory and you can immediately start using the cluster.
$ kubectl get nodes NAME STATUS ROLES AGE VERSION tme-lnx7-taco Ready controlplane,etcd,worker 15m v1.14.3 tme-lnx8-taco Ready controlplane,etcd,worker 15m v1.14.3 tme-lnx9-taco Ready controlplane,etcd,worker 15m v1.14.3
The next steps include installing Helm and Tiller. I’d refer to the minutia in the official docs but one thing I wanted point out here is if you wanted to run the 2.3 alpha, you need to specify the specific version when deploying the chart.
$ helm install rancher-alpha/rancher \ --name rancher \ --namespace cattle-system \ --set hostname=rancher.tacos.datamattsson.io \ --version=2.3.0-alpha5
My hostname points to a L4 load-balancer that in turn points to my nodes (port 80 and 443) in the initial Rancher cluster. This can also be achieved with round-robin DNS for lab setups.
Once the chart is deployed, you’ll be able to login to the Rancher UI via the hostname provided (your view will differ as the "first login” dance require you to set a password):
Quickly riffing through the tabs I immediately found the “Add Cluster” button. Since I’m installing BYOD-style I simply selected “custom” and Rancher generates a docker command-line to paste into your nodes, simply by selecting the role it'll add the appropriate flags to the command-line text blob you conveniently copy out of the UI.
As nodes start to come online they immediately become available in the UI. So you get immediate feedback what you're doing is working. Once completed, the cluster will show up as a drop-down upper left tab. This is the landing page a few minutes later:
Conveniently enough you immediately have access to a kube-cuddle terminal in the browser window. I’m always sceptic against these sort of things but I could inspect my nodes and deploy workloads from external resources right off the bat. And, drum roll, scrolling, selecting text, copying and pasting, WORKS!
Baffled by how simple it was getting to where I am, I wasn’t very surprised finding very elaborate and visually pleasing configuration for apps, monitoring, logging, notifications & alerts, user management & RBAC and persistent storage. Each of these topics warrant their own blog post so I will save these for a rainy day.