worker cluster The worker cluster configuration steps are very similar to the control-panel cluster.
Step 1: Prepare the System
Configure kernel modules by creating a configuration file:
Copy cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF
Load the required kernel modules:
Copy sudo modprobe overlay
sudo modprobe br_netfilter
sudo sysctl --system
Step 2: Install Container Runtimes
Add Docker's official GPG key:
Copy sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
Add the Docker repository to Apt sources:
Copy echo \
"deb [arch=\$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
\$(. /etc/os-release && echo "\$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Install containerd.io:
Copy sudo apt-get install containerd.io
Step 3: Install Container Networking Plugins
Download and install CNI plugins:
Copy wget https://github.com/containernetworking/plugins/releases/download/v1.3.0/cni-plugins-linux-amd64-v1.3.0.tgz
mkdir -p /opt/cni/bin
tar -C /opt/cni/bin -xzvf cni-plugins-linux-amd64-v1.3.0.tgz
Edit the containerd configuration:
Copy nano /etc/containerd/config.toml
Add the following configuration under
Copy [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
You need CRI support enabled to use containerd with Kubernetes. Make sure that cri
is not included in thedisabled_plugins
list within /etc/containerd/config.toml
;
Restart containerd:
Copy sudo systemctl restart containerd
Step 4: Install Kubernetes Tools
Install necessary tools and set up the Kubernetes repository:
Copy sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
List available versions of kubeadm:
Copy sudo apt list -a kubeadm
Install kubeadm, kubelet, and kubectl (replace 1.28.0 with your desired version):
Copy sudo apt-get install kubeadm=1.28.0-00
sudo apt-get install kubelet=1.28.0-00
After completing this process, you now have your worker cluster installed.
Connecting cluster worker with cluster control-plane:
Access your control pane cluster and create the token to connect your worker cluster.
Copy sudo kubeadm token create --print-join-command
A token will be generated see below for an example
kubeadm join 111.231.252.43:6443 --token 17htao.wo5w0fn1rpg21e9m --discovery-token-ca-cert-hash sha256:ea9a3611d926cf9a7cfadb089a0d47500f89bab1g5ef45310b9a8d82a65c48b
Now just copy the generated token into your cluster worker and the connection will be established. Once this is done, when consulting your node you will see the connection successfully.