Bare Metal Kubernetes Series - Part 2: Setting up the machines

I will be using Debian 10. Any distribution that has the apt package manager should be fine though.

We will go through the essential operating system installation steps and at the end I will provide you with a preseed file. With preseeding you can automate the installation of your OS, combine that with some bash scripts that install docker and kubernetes, you can hook up a new node to your cluster in a manner of minutes.

Bootable Media

There are plenty of tutorials for creating a bootable usb media (an usb from which you can install your OS from), but some of them yield different results.
If you are on windows I would recommend rufus, if you are on linux, most distros have the inbuild "Disk Image Writer".

Download only the "..-DVD-1.iso" from here and create your media from it.

Installation

Once you have bootet the image select "Grapical install"

Hostname

The hostname can be set here manually, or be configured in your routers DHCP server (DHCP servers are responsible for assigning IP addresses to hardware addresses).

Since kubernetes likes to resolve the nodes via hostname, you should choose different hostnames for your machines (although they can be easily changed later on).

Domain name

Doesn't matter, you can leave it blank or fill in whatever.

Partitioning disks

The following pictures assume you only have a single disk. The only thing that matters now is creating the partions for our OS and node specific software (this will mostly be docker images later on). For my setup and the amount of images I see myself installing, I used 125GB of my disk space for that.

Choose Manual:

Next we want to setup our storage device/disk, select it and hit continue:

Confirm that you want to (over)write the partion table for that device.

Understanding Storage

This is a good point to explain some core concepts about storage in a kubernetes cluster. Only by understanding how and where things are stored, you can properly organize the disk space you have.

Node local storage

This is storage that the node only uses for itself, not sharing it with anybody else. This storage contains:

  • kubernetes itself (it's binaries and dependencies)
  • kubernetes settings and configurations (information about services, pods, deployments etc.)
  • docker images from which our pods are created

Shared storage

In case one of our nodes fails, we still want all our applications to still be able to run. Thus we need some sort of storage that can handle that. In a later part of the series we will go into depth on that.

For now you only need to know that there is some ominous system that takes multiple partitions / storage devices, from different nodes and fuses them into one giant storage, that also is failure resistant, meaning any single device can fail and you still have full access to all your data.

Partitions

Now we are going to create the following partitions:

  1. 256 MB large EFI partition. Our system needs that to boot UEFI correctly
  2. A partition for our local node storage
  3. A partition for our shared storage

You can size the second and third partition however you like.

EFI System Partition

Create it as a primary partition, selecting the start point to Beginning. As size you want to enter 256MB.

OS Partition

Next up is the partition for the operating system, it also should be primary and start at the the Beginning of the free space. As size you can either enter 50% or a fixed GB size (like 125GB).

Cluster storage Partition

This one can be a logical partition, but also should start at the Beginning. I recommend using all of the available space (the partition manager fills that in per default).

Aaand we are done. Ready to write the changes. Ignore whatever warnings come up now, and simply choose the option that will allow you to continue.

  • It doesn't matter that the fat32 partition isn't mounted, since we will be using it only for boot
  • We don't need swap, kubernetes explicitly urges you to turn it off

Choosing features

Since we will be running our servers as a node only, we don't need any fancy GUIs, the basic command line and ssh will to the trick.

Installing GRUB

Select the first available device:

Installing the core dependencies

Once your machine has booted up, you want to ssh into it.

Login with the user you created during the debian setup.

Now follow the instructions for "core.sh" at my Buster_Setup_Preseed repo.

Next up

Part 3: Bootstrapping the cluster

Series Overview

©
Tobias Hübner