Introduction
Besides having a really cool name, Montel Intergalactic
is also a cool company to work with. I met one of their engineers in an
OpenEBS Slack forum and explained to him what I was up to. The next
thing you know within a week we had everything setup at Hetzner. All
Montel wanted in return was this humble blog post. A note to others in
the space, THIS is how you build customer loyalty and a simple gesture
like this can go a long long way.
Needless to say when we decide on our next vendor these guys will be at
the top of the list. In fact, they'll probably be the only ones on that
list (next to OpenEBS of course!).
This blog will outline the detailed steps we took to achieve our goal of
setting up a bare-metal Kubernetes cluster at Hetzner from scratch
using Rancher 2.x - Hetzner node driver, OpenEBS, Cert-Manager, Nginx
Ingress loadbalancing and the deployment of the Tutem - Hello World app
to demonstrate loadbalancing and Let's Encrypt.
NOTE: All nodes are created with Hetzner CX21 type servers. Our root domain is: cooby.tech and an "A" record called rancher.cooby.tech points to the instance IP.
Initial Setup
We'll be creating 4 Hetzner cluster servers:
- front-1 nginx-ingress loadbalancing (type: worker)
- control-1 control plane (type: etcd, control)
- worker-1 first worker (type: worker)
- worker-2 second worker (type: worker)
- Spin up a Hetzner CX21 instance with a Ubuntu 18.04 image
- Generate a keypair and make sure you can ssh into the instance
- Install docker and docker-compose from your local machine:
curl https://gist.githubusercontent.com/gridworkz/d78c290c4e6fd7753dc21bb50601745a/raw/625fc3b7ddb7a654fe379f67d0bb9c6ac5b9413a/InstallDockerCompose | ssh -i ~/.ssh/<privkey> root@rancher.cooby.tech "/bin/bash -s"
- Login to the instance and add a docker-compose.yml file to run Rancher:
- Run: docker-compose up -d
- Install Hetzner node-driver from: https://mxschmitt.github.io
- Create a node-template for frontend
- Add label loadbalancer=true
- Remove iscsi driver with cloud-init:
- Create a node template for workers using the same cloud-config
Adding Nginx-Ingress
- *.cooby.tech A <loadbalancer machines>
- example1.cooby.tech and to use nginx ingress to route it to the example1 workload. Also in the DNS server you can do, for example, cooby.in.montel.care CNAME montel.cooby.tech and again use our nginx-loadbalancer to route cooby.in.montel.care to your desired workload.
Will be automatically handled by Let's Encrypt.
- Login to each node and run: apt-get install open-iscsi
- Confirm that open-iscsi is active: systemctl status open-iscsi
- Navigate to global -> catalog in Rancher UI and enable Helm/Stable
- Select OpenEBS and install it via Helm Charts