[บันทึกกันลืม] วิธีเพิ่ม Node (Ubuntu 22.04) เข้า Kubernetes cluster (version 1.26.15)

หากเป็น node เก่า อย่าลืมทำ [บันทึกกันลืม] K8S เอา node เดิม join กลับเข้ามาไม่ได้ เป็นปัญหาเพราะ CNI

Adding a new node running Ubuntu 22.04 to Kubernetes version 1.26.15 cluster. Hope this help.

swapoff -a
sed -i 's/\/swap.img/#\/swap.img/g' /etc/fstab
echo 1 > /proc/sys/net/ipv4/ip_forward
modprobe overlay
modprobe br_netfilter
sysctl --system
apt install -y curl gnupg2 software-properties-common apt-transport-https ca-certificates
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update -y
apt install -y containerd
mkdir /etc/containerd
containerd config default > /etc/containerd/config.toml
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml
systemctl restart containerd
systemctl enable containerd
apt -y install curl vim git wget apt-transport-https gpg
mkdir /etc/apt/keyrings
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.26/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.26/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
apt update -y
apt install -y  kubelet=1.26.15-1.1 kubeadm=1.26.15-1.1
apt-mark hold kubelet kubeadm kubectl
systemctl enable kubelet

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.