Skip to content

Architecture

Software stack

The cluster leverages the following software stack:

  • Kubeadm for cluster initialization
  • Project Calico for CNI networking
  • MetalLB to enable the ability to create LoadBalancer services without the need for external cloud providers
  • KVM virtualization
  • Ubuntu 20.04 LTS is used as the operating system of choice on every hardware and virtual machine in the lab

Lab layout

Our k8s cluster will be running on a single phyisical host, serving as the KVM hypervisor for 4 virtual machines that comprise the actual k8s environment. One VM will be the master node and 3 VMs will be the workers.

architecture

Feel free to tweak the number of nodes in the cluster to your own requirements. The minimum k8s set up requires at least one master and one worker node, but such a low number of workers will render moot features, such as replicasets, that benefit from scale. It will also make it difficult to upgrade your cluster without taking downtime.

Hardware Requirements

KVM host

Any relatively modern and moderately powerful PC or server is sufficient for this lab. You don't need a "beast" of a machine. The only hard requirement is that your CPU supports hardware virtualization. See Install and Configure KVM section for more details.

The author uses the following configuration for the KVM PC that hosts his own k8s cluster:

Component Configuration
CPU AMD Ryzen 5 3600 6-core 12-thread
RAM 32GB DDR4 3200 RAM (dual-channel preferred)
OS storage 1TB NVME SSD
VM storage 1TB SATA SSD (optional, but highly recommended)
GPU ASUS GT 1030 (any low-end GPU or CPU with APU will do)
Network Embedded 1Gb NIC

Virtual Machines

All virtual machines (master and worker nodes) will have the same configuration:

Component Configuration
CPU 2 VCPUs
RAM 4GB
Storage 100 GB

Networking

Particular care needs to be taken when planning out network layout for the lab, especially if your k8s setup shares IP space and broadcast domains with your normal home network. How exactly you are setting things up will largerly depend on your current network layout, but you need to ensure that IP range for the k8s lab doesn't overlap with DHCP ranges that might be active on your network.

Subnet ranges

There are two key subnets that we need to keep in mind for our setup: external, sharing your home network, and internal, where k8s pods reside. Since this setup is intended for a home lab, where there is a flat addressing scheme on the external network, it's suggested that you segment the address space into non-overlapping IP blocks, each assigned a specific purpose. This tutorial will use the following layout:

networks

Network

If you have a different IP addressing scheme than the one used in this guide, make sure to change IP addresses in commands that reference specific IPs, such as kubeadm init and others as you follow along. Don't worry, we will remind you to pay particular attention to the IP addressing when needed.

IP Address Reference

Below is a handy reference to the IP addresses used in the lab. If you choose to use a different IP addressing scheme that better suites your home lab setup, we recommend that you document the IP layout in the "Your lab" column below before you proceed to the rest of this walk-through.

Description k8sh.net lab Your lab
External subnet CIDR 10.0.0.0/24
Default Gateway 10.0.0.1
DNS server 10.0.0.1
KVM server 10.0.0.235
kubernetes-master 10.0.0.221
kubernetes-worker1 10.0.0.222
kubernetes-worker2 10.0.0.223
kubernetes-worker3 10.0.0.224
MetalLB IP range 10.0.0.180 - 10.0.0.199
POD subnet CIDR 192.168.0.0/16