Prerequisites
- Minimal Installed Debian 12 /11
- 2 CPU / vCPU
- 2 GB RAM
- 20 GB free disk space
- Sudo User with Admin rights
- Stable Internet Connectivity
- Ensure that each node can communicate with the others via a reliable network connection.
1. 设置hostname和hosts文件
sudo hostnamectl set-hostname "master" // Run on master node
sudo hostnamectl set-hostname "node1" // Run on 1st worker node
sudo hostnamectl set-hostname "ndoe2" // Run on 2nd worker node
/etc/hosts 配置
10.0.8.2 master
10.0.0.6 node1
10.0.8.15 node2
2. 关闭所有节点的swap
目的:1. 平滑运行 2. 让内存泄漏的容器快速死亡
sudo swapoff -a
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
debian 非root下可能没有设置/usr/sbin 的环境变量,导致无法执行一些命令,设置下即可。
3. 添加防火墙规则
安装Container
安装前所有节点设置内核参数
$ cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
$ sudo modprobe overlay
$ sudo modprobe br_netfilter
$ cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-k8s.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
执行 sudo sysctl --system
使得参数修改生效
安装Container
sudo apt update
sudo apt -y install containerd
在所有节点生成导入默认配置
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&1
使用SystemdCgroup配置,将 ‘SystemdCgroup = false’ 修改为 ‘SystemdCgroup = true‘
sudo vi /etc/containerd/config.toml
重启服务使配置生效
sudo systemctl restart containerd
sudo systemctl enable containerd
标签:node,hostname,kubernetes,containerd,sudo,etc,set,Debian12,安装
From: https://www.cnblogs.com/YueQAQ/p/18262196