control pane cluster

Step 1: Prepare the System

  • Configure kernel modules by creating a configuration file:

cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF

Load the required kernel modules:

sudo modprobe overlay
sudo modprobe br_netfilter
sudo sysctl --system

Step 2: Install Container Runtimes

  • Add Docker's official GPG key:

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:

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:

sudo apt-get install containerd.io

Step 3: Install Container Networking Plugins

  • Download and install CNI plugins:

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:

nano /etc/containerd/config.toml

Add the following configuration under

[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:

sudo systemctl restart containerd

Step 4: Install Kubernetes Tools

  • Install necessary tools and set up the Kubernetes repository:

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:

sudo apt list -a kubeadm

Install kubeadm, kubelet, and kubectl (replace 1.28.0 with your desired version):

sudo apt-get install kubeadm=1.28.0-00
sudo apt-get install kubelet=1.28.0-00
sudo apt-get install kubectl=1.28.0-00

Step 5: Initialize Kubernetes Control Plane

  • Pull the required container images:

sudo kubeadm config images pull --kubernetes-version=1.28.0

Initialize the Kubernetes control plane (replace 1.28.0 with your desired version):

sudo kubeadm init --kubernetes-version=1.28.0

Follow these steps carefully to set up your Kubernetes control plane successfully. Make sure to adjust the versions and configurations as needed for your specific requirements. At the end of the steps, your instance must be configured.

To start the cluster you need the following steps:

Run the mentioned commands with root user

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf SHOME/.kube/config
sudo chown $(id -u):$ (id -g) $HOME/.kube/config

Now we need to install the network plugin in Kubernetes.

Can be installed onto your CNI-enabled Kubernetes cluster with a single command:

sudo kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml

After completing this process, you now have your control plane cluster installed and configured.

To test whether it is working as expected, you can check the node status.

sudo kubectl get nodes -o wide

Last updated