[ macOS/ARM64 | Linux/AMD64 ]
This chapter is a "TLDR" version of this guide that contains pure instructions for setting up the Kubernetes deployment. Explanations and "theoretical introductions" are omitted. Most of the work is contained within scripts shipped with this repository.
Table of Contents generated with DocToc
- Install necessary software
- Clone the repository
- Bootstrap security
- Prepare VM environment
- Launch and connect the VMs
- Install the control plane
- Set up Kubernetes nodes
- Install essential cluster services
- One script to run them all
brew install qemu wget curl cdrtools dnsmasq tmux cfssl kubernetes-cli helm
git clone https://github.com/ghik/kubernetes-the-harder-way
cd kubernetes-the-harder-way
Go to auth
directory:
cd auth
Generate certificates, kubeconfigs, and an encryption key:
./genauth.sh
./genenckey.sh
Configure kubeconfig
on the host machine:
./setuplocalkubeconfig.sh
Go back to parent directory:
cd ..
Download the base image:
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-arm64.img
Make sure you have an SSH public key (~/.ssh/id_rsa.pub
). If not, generate with:
ssh-keygen
Set up VM images and configs:
./vmsetupall.sh
Set up host network (DHCP, DNS, NFS):
sudo ./setuphost.sh
Or, if you're planning to use Cilium:
sudo USE_CILIUM=true ./setuphost.sh
It is recommended to have the following settings in ~/.tmux.conf
:
set -g mouse on
bind C-s setw synchronize-panes
Launch the VMs (in a detached tmux
session):
sudo ./vmlaunchall.sh kubenet-qemu
Connect to VMs with SSH (in a separate terminal)
./vmsshall.sh kubenet-ssh
Upload VM setup scripts:
./deploysetup.sh
Upload security files to VMs:
./auth/deployauth.sh
Optionally, if you don't want to waste bandwidth by downloading the same binaries on every VM, download them once and upload to each VM:
./deploybinaries.sh
Go to ssh-controls
window of the kubenet-ssh
TMUX session.
Enable pane synchronization (Ctrl
+b
,:setw synchronize-panes on
or use shortcut if you have one configured).
Run on all control
nodes:
sudo ./setupcontrol.sh
Go to ssh-gateway
TMUX window and run:
sudo ./setupgateway.sh
Go to ssh-nodes
window of the kubenet-ssh
TMUX session and enable pane synchronization.
Run on all control
and worker
nodes:
sudo ./setupnode.sh
Or, if you want to use Cilium:
sudo USE_CILIUM=true ./setupnode.sh
If you do not use Cilium, configure pod CIDR routes on the host machine:
sudo ./setuproutes.sh
Important
Routes must be added while at least one VM is running, so that the bridge interface exists. Unfortunately, they will be removed once you shut down all the VMs.
Give kube-apiserver
permissions to call kubelet
. On the host machine, invoke:
./setupkubeletaccess.sh
On the host machine, add necessary helm repositories:
./addhelmrepos.sh
Then, to install all essential services:
./setupcluster.sh
Or, if you want to use Cilium:
USE_CILIUM=true ./setupcluster.sh
All of the above steps have been additionally automated with a single setupall.sh
script.
Invoke it as ./setupall.sh
or USE_CILIUM=true ./setupall.sh
.