Orchestrator

Usage

Download kubectl on your laptop, e.g. brew install kubectl copy the content of the following files that are present on your master node to your laptop:

  1. /etc/kubernetes/pki/ca.crt

  2. /home/kubecreds/kubeadm.crt

  3. /home/kubecreds/kubeadm.pem (with care, ideally chmod 600)

Then, configure kubectl:

ssh -fNT -L 12345:<hosname of your master node>:6443 <ssh name of your client ssh configuration>

kubectl config set-cluster osgiliath --server=https://127.0.0.1:12345 --certificate-authority=/home/charliemordant/.ssh/ca.crt --tls-server-name=kubeadm.osgiliath.net
kubectl config set-credentials kubeadmin.osgiliath --client-certificate=/home/charliemordant/.ssh/kubeadm.crt --client-key=/home/charliemordant/.ssh/kubeadm.pem
kubectl config set-context osgiliath --cluster=osgiliath --user=kubeadmin.osgiliath
kubectl config use-context osgiliath

Troubleshooting

Unfortunately, no real role allowing to uninstall everything have been created.

If it messes up with something, here is the procedure to uninstall everything to be able to reinstall the roles if something has gone wrong (usually, ansible_orchestration role executes that procedure)

sudo kubectl drain <node name> --delete-local-data --force --ignore-daemonsets # only on master
sudo kubectl delete node <node name> # only on master
sudo kubeadm reset
sudo dnf remove kubeadm kubectl kubelet kubernetes-cni kube*
sudo rm -rf ~/.kube
sudo rm -rf /etc/kubernetes/
sudo rm -rf /var/lib/etcd/
sudo rm -rf /usr/lib/kubelet
sudo rm -rf /var/lib/kubelet

or if you missed it

on master

sudo dnf remove kubelet kubectl kubeadm kubernetes-cni
sudo rm -rf /etc/kubernetes/
sudo rm -rf /var/lib/etcd/
sudo rm -rf /etc/calico
sudo service containerd stop
sudo rm -rf /var/lib/kubelet   # with errors
sudo umount <errors>
sudo rm -rf /usr/lib/kubelet