Source

Smallest Kubernetes Cluster Installation with Rancher as Cluster Manager

Kubernetes or simply K8s is becoming the de-facto standard for deploying workloads on different private, public or hybrid cloud providers like AWS, VMWare, OpenStack etc.

Rancher is a Kubernetes Cluster Manager which can be installed itself into a Kubernetes Cluster which itself can be provisioned with rancher/rke, an extremely simple, lightning fast Kubernetes installer that works everywhere.

This blog post is going to dive you through a

  • minimal (one node) Kubernetes installation using rancher/rke
    (which is easy extensible to N nodes)
  • with Rancher — the Kubernetes Cluster Manager — included.

So if you just wanna spin up a minimal Kubernetes Cluster here we go.

Update on May 5th, 2019: we posted a follow-up article where the second point in the Overview (Spawn a Kubernetess Cluster using rke) is done by defining our infrastructure as code using Terraform and the terraform-rke-provider rather than doing it manually.

Overview

tl;dr

  1. Prepare node (virtual/bare metal machine)
  2. Spawn a Kubernetes Cluster using rke
  3. Install Cert-manager and Rancher (including TLS) via Helm
  4. Set password for user admin
  5. Login & enjoy the smallest Kubernetes Cluster with Rancher included

Prerequisites

  • Basic knowledge of Kubernetes, Helm and RKE
  • A workstation (probably your Computer/Laptop) with rancher/rke, kubectl and helm installed — referred as devstation
  • A (virtual) machine with SSH access keys — referred as node1 
    Minimum: 2GB RAM / 1 vCPU
    Recommendation: 4GB RAM / 2 vCPU

This installation method is tested with virtual machines of HetznerCloud, DigitalOcean and AWS (Referral links with free quota included).

A little bit of History

Kubernetes is not easy to set up. There are plenty of tools and methods with their respective pros and cons.

Rancher (including rancher/rke) is a tool to deploy and manage Kubernetes Clusters.

How It All Started
In 2014, containers were quickly becoming the de-facto large-scale production platform for application deployment. In founding Rancher Labs, the initial goal was to provide organizations with the tools needed to take full advantage of container technology and provide the best possible experience for running Docker in production. Fast-forward to present day, the ecosystem changed and so did we. We are more confident than ever that containers and Kubernetes will enable a new era of application portability. Rancher is a major step forward in open source container management, accelerating the adoption of Kubernetes for organizations globally.

Source (up and down): https://rancher.com/ (04.10.18)

Rancher is enterprise management for Kubernetes.
Every distro. Every cluster. Every cloud.
Rancher is tightly coupled to Kubernetes since their 2.x release.

Step-by-step guide

1. Prepare node1

SSH into your (virtual) machine node1 and install Docker version needed for Kubernetes (as of Oct. 2018: 18.06.2).
This walkthrough refers to Linux Ubuntu 16.04 — other distributions may need different (docker) installation methods.

2. Create your Kubernetes Cluster from devstation using rke

Configure rke from devstation by following the instructions — basically you have to set your IP address (or domain) and location of the SSH key to connect to your node1.

Test your Cluster installation with command above (Gist rke.sh)

3. Install Cert-manager and Rancher (including TLS) via Helm

Next step is to install/init helm (including the the server-side component tiller) and install cert-manager and rancher using helm. Rancher server is designed to be “secure by default” and requires SSL/TLS configuration thus we are going to use the letsEncypt option.

You should create a DNS record or alternatively update your /etc/hosts pointing your domain eg. rancher.your-host.com to your IP address and provide an E-Mail address if you want to use Let’s Encrypt for certificates.

`helm list` will output installed Helm charts

4. Set password for user admin

Access Rancher with https://rancher.your-host.com and initially set password for user admin.

5. Login

Login & enjoy the smallest Kubernetes Cluster with Rancher included :)

Provide the password set in the previous step for user admin and login
Rancher installs itself in the Kubernetes Cluster (with helm install rancher) and imports the local cluster created with rke
Dashboard of local cluster

Ressources

Final Words and Updates

You are free and welcome to post your K8s installation/cluster management alternatives or hints in the comments.

This article has been submitted to Hacker News and reddit on the 2nd of May 2019.

There’s a follow-up article introducing Terraform in our workflow to help us build reproducable and idempotent deployments by defining our infrastructure as code:
Deploy a Kubernetes Cluster using Terraform and RKE Provider.

Thanks for reading.

💋 Keep it simple and stupid.