The following describes a quick and dirty recipe to get a Kubernetes worker node installed.
Note this assumes you have the latest version of Docker already installed on your worker node.
Log into the worker node. And become root using:
sudo su
Then open /boot/cmdline.txt and add the following to the end of the line:
cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1
Then turn off your swap using:
dphys-swapfile swapoff && dphys-swapfile uninstall && update-rc.d dphys-swapfile remove
Reboot the worker node using:
/sbin/reboot
After the reboot log back into your worker node and become root using:
sudo su
Then add the kubernetes repositories using:
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee /etc/apt/sources.list.d/kubernetes.list && apt-get update -q && apt-get install -qy kubeadm
Then in a separate terminal log into the Kubernetes master and become root using:
sudo su
Then list the available kubeadm tokens using:
kubeadm token list
If the list is NOT empty skip the following step, otherwise issue:
kubeadm token create
Back on the worker node it is time to join the Kubernetes cluster using:
kubeadm join —token <token> <master_ip:6443> --discovery-token-unsafe-skip-ca-verification
Replace token
with the value of the output of the kubeadm command
shown in the terminal window that is logged into the Kubernetes master.
And replace master_ip
with the IP address of the Kubernetes master.
And voila your worker node is now joining the Kubernetes cluster.
Posted February 2nd, 2018