Kubernetes : Install Kubeadm2022/11/02 |
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
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 #/swap.img none swap sw 0 0 # switch to Cgroup v1 (default is v2)
root@ctrl:~#
vi /etc/default/grub # line 11 : add GRUB_CMDLINE_LINUX=" systemd.unified_cgroup_hierarchy=0 "
update-grub
|
[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.gpg root@ctrl:~# echo "deb [signed-by=/etc/apt/keyrings/kubernetes-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | tee /etc/apt/sources.list.d/kubernetes.list
root@ctrl:~#
vi /etc/default/kubelet # create new
KUBELET_EXTRA_ARGS=--cgroup-driver=systemd --container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock
root@ctrl:~#
systemctl edit containerd.service # add follows
[Service]
KillMode= KillMode=mixed systemctl restart containerd.service
|
Sponsored Link |
|