Installing Kubernetes (Rancher 2) with Terraform and Ansible

In this tutorial series we are going to cover how to use Ansible through Docker, in order to install / provision one or more hosts for running Rancher 2 / Kubernetes.

This tutorial series is primarily aimed at self-hosters: people who want to install, run, and manage their own infrastructure. Plenty of off-the-shelf solutions exist for Kubernetes, such as offerings from Google, Amazon, and (comparatively) smaller players like Digital Ocean.

Managing your own infrastructure has a selection of challenges to overcome, and if you're after a working solution, as quickly as possible, then this may not be the right approach for you.

One of the advantages of self-hosting your own Rancher 2 / Kubernetes setup is that the hardware you will be using will potentially be much more powerful than paying per month for an off-the-shelf solution.

However, this comes

As ever, weigh up the pros and cons and make your own decision.

Minimum System Requirements

You will need at least two publicly available servers to complete this tutorial.

One server will be a dedicated load balancer. You can also use Amazon's NLB, but that won't be the route we take in this tutorial.

This load balancer can be fairly low spec. I'll be using the cheapest VPS on offer.

Another server (or several) will become the High Availability (HA) Cluster Nodes onto which we install Rancher 2, and Kubernetes. Each node will fulfill one or several roles in our cluster, all of which will be managed by our Ansible configuration.

This, or these servers should be as high spec as you can reasonably afford. I use Hetzner's server auctions to get decent spec kit at affordable prices. Going with a VPS option such as Digital Ocean, or Amazon will cost you significantly more for the same hardware.


Presented By