During some of the manipulation of the partition table of my SD card, I ended up screwing up both my SD card and my backup Win32DiskImage backup. Moreover if your SD card is 32G, it takes around 30 minute to restore from backup. Hence the idea to come up with a way to build more resiliency in the cluster. Recreating a node from scratch should not take more than 10 mn. The propose procedure is still rather long because I did not push enough yet what the HypriotOS team, aka build a default SD image where cloud-init does 100% of the initialization work.
Flash HypriotOS to SD and reboot Pi.
Flash the SD Card with HypriotOS
Connect Pi through to the cluster switch
Access the Master PI, run arp -a
and find the new IP.
Freeze the new IP in the dhcpcd.conf
ssh <masterip>
arp -a
vi /etc/dhcp/dhcpd.conf
Access the node from the Master PI:
ssh 192.168.2.xxx
docker ps
Freeze your configuration
sudo apt-get remove --purge cloud-init
sudo apt-get autoremove
Set the host name
sudo vi /etc/hosts
sudo hostnamectl set-hostname <xxx>
Firt access the kubemaster node and regenerate a token (if you did not use ttl=0 when using kubeadm init on the master):
kubeadm token create
sudo -i
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
apt-get update && apt-get install -y kubeadm kubectl kubelet
To help during the initialization phase, get kubeadm to download the images onto docker
kubeadm config images pull
Get the node to join the cluster
kubeadm join 192.168.2.1:6443 --token yyyyyy.xxxx --discovery-token-ca-cert-hash sha256:zzzz