Debian 12 bookworm
Sponsored Link

Kubernetes : Install Kubeadm2023/07/28

 

Install Kubeadm to 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].

-----------+---------------------------+--------------------------+------------
           |                           |                          |
       eth0|10.0.0.25              eth0|10.0.0.71             eth0|10.0.0.72
+----------+-----------+   +-----------+-----------+   +-----------+-----------+
|  [ ctrl.srv.world ]  |   |  [snode01.srv.world]  |   |  [snode02.srv.world]  |
|     Control Plane    |   |      Worker Node      |   |      Worker Node      |
+----------------------+   +-----------------------+   +-----------------------+

[1] Install Containerd and apply some requirements on all Nodes.
root@ctrl:~#
apt -y install containerd iptables apt-transport-https gnupg2 curl sudo
root@ctrl:~#
containerd config default | tee /etc/containerd/config.toml

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

# line 125 : change
SystemdCgroup = true

root@dlp:~#
systemctl restart containerd.service
root@ctrl:~#
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@ctrl:~#
sysctl --system
root@ctrl:~#
modprobe overlay; modprobe br_netfilter

root@ctrl:~#
echo -e overlay\\nbr_netfilter > /etc/modules-load.d/k8s.conf
# needs [iptables-legacy] for iptables backend
# if nftables is enabled, change to [iptables-legacy]

root@ctrl:~#
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@ctrl:~#
swapoff -a

root@ctrl:~#
vi /etc/fstab
# comment out
#/dev/mapper/debian--vg-swap_1 none            swap    sw              0       0
[2] Install Kubeadm, Kubelet, Kubectl on all Nodes.
root@ctrl:~#
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg

root@ctrl:~#
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@ctrl:~#
apt update

root@ctrl:~#
apt -y install kubeadm kubelet kubectl

root@ctrl:~#
ln -s /opt/cni/bin /usr/lib/cni

Matched Content