Bare metal Ubuntu Kubernetes May 2019
I left the K8s alone fo some months and the install nuked itself. So, it has been at least a year since I first installed it, lets start again.
Tear down Kubernetes
The correct details are here:
This works too:
sudo kubeadm reset apt remove --purge kube*
Tear down Docker
Install docker again
I’m doing this on two linux servers.
cd ~/dev/getdocker curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker jonathan docker run hello-world
Install the master and the slave
So, in summary, you need to follow the guide!
Key features, kubeadmin, kubectl, flannel, and then setting it up to work with Docker and sorting out the silly swap issue.
You need to configure it for Docker, don’t forget. https://kubernetes.io/docs/setup/cri/
If you want to use kubectl get nodes etc from both master and slave, then copy the ~/.kube/config from the master box to the user on the slave, then you can run the commands on the slave as well.
Dealing with errors
“It seems like the kubelet isn’t running or healthy.”
The tools you use are:
systemctl status kubelet journalctl -xeu kubelet
For instance you can see from the journalctl for the above error that it is the swap issue, in which case you can:
sudo swapoff -a sudo sed -i '/ swap / s/^/#/' /etc/fstab
Or add the line below to /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
Other useful commands
Start again with kubelet and kubeadmin
kubeadm reset systemctl daemon-reload systemctl restart kubelet
Restarting for whatever reason
systemctl restart docker systemctl restart kubelet
Need a new kubernetes master join token
kubeadm token list kubeadm token create --print-join-command