Ubuntu 24.04
Sponsored Link

Kubernetes : Install Kubeadm2024/06/07

 

Configure Multi Nodes Kubernetes Cluster.

This example is based on the environment like follows.

For System requirements, each Node has unique Hostname, MAC address, Product_uuid.
MAC address and Product_uuid are generally already unique one if you installed OS on physical machine or virtual machine with common procedure.
You can see Product_uuid with the command [dmidecode -s system-uuid].

+----------------------+   +----------------------+
|  [ ctrl.srv.world ]  |   |   [ dlp.srv.world ]  |
|     Manager Node     |   |     Control Plane    |
+-----------+----------+   +-----------+----------+
        eth0|10.0.0.25             eth0|10.0.0.30
            |                          |
------------+--------------------------+-----------
            |                          |
        eth0|10.0.0.51             eth0|10.0.0.52
+-----------+----------+   +-----------+----------+
| [ node01.srv.world ] |   | [ node02.srv.world ] |
|     Worker Node#1    |   |     Worker Node#2    |
+----------------------+   +----------------------+

[1] On all Kubernetes Cluster Nodes except Manager Node, Change settings for System requirements.
root@dlp:~#
apt -y install containerd
root@dlp:~#
mkdir /etc/containerd

root@dlp:~#
containerd config default | tee /etc/containerd/config.toml

root@dlp:~#
vi /etc/containerd/config.toml
# line 65 : change
sandbox_image = "registry.k8s.io/pause:3.9"

# line 137 : change
SystemdCgroup = true

root@dlp:~#
systemctl restart containerd.service
root@dlp:~#
cat > /etc/sysctl.d/99-k8s-cri.conf <<EOF
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
net.ipv4.ip_forward=1
EOF
root@dlp:~#
sysctl --system
root@dlp:~#
modprobe overlay; modprobe br_netfilter

root@dlp:~#
echo -e overlay\\nbr_netfilter > /etc/modules-load.d/k8s.conf
# switch to [iptables-legacy] for iptables backend

root@dlp:~#
update-alternatives --config iptables

There are 2 choices for the alternative iptables (providing /usr/sbin/iptables).

  Selection    Path                       Priority   Status
------------------------------------------------------------
* 0            /usr/sbin/iptables-nft      20        auto mode
  1            /usr/sbin/iptables-legacy   10        manual mode
  2            /usr/sbin/iptables-nft      20        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/sbin/iptables-legacy to provide /usr/sbin/iptables (iptables) in manual mode

# disable swap

root@dlp:~#
swapoff -a

root@dlp:~#
vi /etc/fstab
# comment out
#/swap.img      none    swap    sw      0       0

# disable apparmor profiles below

root@dlp:~#
apparmor_parser -R /etc/apparmor.d/runc

root@dlp:~#
apparmor_parser -R /etc/apparmor.d/crun

root@dlp:~#
ln -s /etc/apparmor.d/runc /etc/apparmor.d/disable/

root@dlp:~#
ln -s /etc/apparmor.d/crun /etc/apparmor.d/disable/

[2] On all Kubernetes Cluster Nodes except Manager Node, Install required packages.
root@dlp:~#
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg

root@dlp:~#
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
root@dlp:~#
apt update

root@dlp:~#
apt -y install kubeadm kubelet kubectl
Matched Content