Okay, obviously this doesn't make a lot of sense in a production environment. But everyone needs to start somewhere, and if you are planning to get started with kubernetes , setting up the smallest instance of a cluster might actually be a good choice for you. There are other alternatives like e.g. minikube ,  but I kind of like to keep my workstation clean. Rather than installing the cluster locally on my machine, I decided to use an available Linux VPS box and only install the kubectl client on my local machine.

So, let's get started. My machine is running Ubuntu 18 LTS (bionic beaver).

Step 1: install docker

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt update && sudo apt install docker-ce

Primarily for performance reasons, it is a good idea to switch off swapping on the target machine.

sudo swapoff -a

sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab

Step 2: install kubeadm

sudo apt-get update && sudo apt-get install -y apt-transport-https && curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list && sudo apt-get update

sudo apt install -y kubeadm  kubelet kubernetes-cni

Step 3: initialise your cluster

sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.178.11

(adjust the advertise address to match your machine)

Step 4: make kubectl work for your non-privileged user

mkdir $HOME/.k8s

sudo cp /etc/kubernetes/admin.conf $HOME/.k8s/

sudo chown $(id -u):$(id -g) $HOME/.k8s/admin.conf

export KUBECONFIG=$HOME/.k8s/admin.conf

echo "export KUBECONFIG=$HOME/.k8s/admin.conf" | tee -a ~/.bashrc

Step 5: install a networking model

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml

Step 6: allow master to be used as worker

kubectl taint nodes --all node-role.kubernetes.io/master-

And that's it. Have fun k8s'ing...