Baremetal Kubernetes Cluster - Creating the Virtual Machines

This is part of a series on creating a Kubernetes cluster. In this post, we'll be creating the virtual machines and preparing them to install Kubernetes (k8s).

For my cluster, we'll be using four Debian 10 "buster" servers. These will be hosted on a VMWare ESXi physical server. One server will be the k8s master node, and the other three will be worker nodes. I had success with Fedora 29 in my previous cluster, and I'll try to highlight any different steps along the way in case you prefer Fedora. You can mix and match distributions in nodes, but you'll probably have fewer issues if you keep your servers consistent.

Download the Debian 10 ISO for your architecture (likely AMD64), and use it to boot a virtual machine. Create the master node first with 2 vCPU and 4GB memory. We'll be using NFS for the containers' storage needs, so a 10GB hard drive will be sufficient. The worker nodes will have 4 vCPU and 8GB memory with the same 10GB hard drive.

I won't screenshot every step of the install, but there are a few key points to note. When asked for hostname, I suggest a naming strategy that identifies the machines. I used k8s-master for the master node and k8s1 k8s2 k8s3 for the worker nodes.

After you answer the basic region and user questions, you will be asked to partition the disk. You need to do manual partitioning to ensure there is no swap partition because k8s does not support swap.

Select Manual partitioning
Select your virtual disk
Create an empty partition table
Select your primary partition
Create a new partition
Use all disk space or enter "max"
Create a Primary partition
Use the defaults and select "Done setting up the partition"
Select "Finish partitioning and write changes to disk"
Confirm you're not using a swap partition
Confirm writing the changes the disk

Once the base system has been installed, select the minimal installation for this headless server.

Select SSH server and standard system utilities
Install GRUB to the boot loader
Select the virtual disk

At this point, the install will finish and the machine will reboot. After rebooting, you'll be at a login prompt.

Before we can continue, we need to login as root and configure sudo for our user. Login using the username root and the password you selected during install.

At the prompt, enter this command to install sudo and add your user to the sudo group (replace <username> with the username you chose during installation).

apt update && apt install -y sudo && usermod -aG sudo <username>

Lastly, we need to know the IP address of this server. Type ip addr to find the IP address. Note: If you want to control the IP address via DHCP reservation, now is a good time to configure that and reboot.

Find the IP address for your network card

Type exit to logout.

From now on, we'll use ssh to login to the server with the username you created earlier. If your workstation/laptop has Linux, you should have ssh already, but if you're on Windows you'll want to download Putty.

Enter the IP address and click Open

Check that you can login to the server with the username that you configured earlier (not root). For convenience, you may wish to setup public key authentication. We will use these ssh sessions to manage the servers for the rest of the article.

Repeat the steps above for each of the virtual machines that will belong to the cluster. (k8s1, k8s2, k8s3).

Now that we have some servers, it's time to install Kubernetes.