Kubernetes the hard way on bare metal/VMs — V1.12

An all encompassing series designed for beginners. From VM configuration to K8S cluster building.

Kubernetes Logo


Setting up the resources

VMs used in this tutorial.

Kubernetes Subnet — <- This is just my home network
POD_CIDR — <- This is the private network the PODS will use.
SERVICE_CIDR — <- This is the private network the services will use.

This PC (Lab machine)
This is the PC from which most of the commands in this guide will be run when configuring SSl/TLS, configs, running kubectl and more. We’ll copy files & configs to controllers & nodes as required later.

k8s-controllers-lb-VIP: (aka KUBERNETES_PUBLIC_IP)

If you wanted to do a single node setup, you could do everything in this guide on the one node; it would work as both a controller and worker.
You could also set up one controller and one worker. The number of each is pretty much limitless.

cat << EOF | sudo tee /etc/hosts k8s-lb k8s-controllers-lb controller-0 controller-1 controller-2 worker-0 worker-1 worker-2

Installing packages

mkdir ~/k8s-the-hard-way-bare-metal
cd ~/k8s-the-hard-way-bare-metal
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/

Setting up the Kubernetes Cluster

sudo apt install conntrack socat -y

Setting up cfssl & generating configs

Generate kubeconfigs and encryption key

Configuring controllers

Configuring the load balancer

Configuring the workers

Configure remote access

Configuring DNS

Testing the cluster




Kubernetes Admin & pretend Golang developer. Come find me on YouTube too: https://www.youtube.com/@LearnWithDrew

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store