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:~#
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

# switch to Cgroup v1 (v2 is the default)

root@ctrl:~#
vi /etc/default/grub
# line 10 : add

GRUB_CMDLINE_LINUX="
systemd.unified_cgroup_hierarchy=0
"
root@ctrl:~#
update-grub

root@ctrl:~#
reboot
[2] Install Kubeadm, Kubelet, Kubectl on all Nodes.
root@ctrl:~#
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg -o /etc/apt/keyrings/kubernetes-keyring.key

root@ctrl:~#
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-keyring.key] https://apt.kubernetes.io/ kubernetes-xenial main" | tee /etc/apt/sources.list.d/kubernetes.list

root@ctrl:~#
apt update

root@ctrl:~#
apt -y install kubelet=1.26.6-00 kubeadm=1.26.6-00 kubectl=1.26.6-00
root@ctrl:~#
ln -s /opt/cni/bin /usr/lib/cni

Matched Content