关闭防火墙
Systemctl stop ufw
Systemctl disable ufw
关闭swap
Swapoff -a
更新源
apt-get update
安装docker
apt insatll docker.io
安装k8s
为了让你的 Linux 节点上的 iptables 能够正确地查看桥接流量,你需要确保在你的 sysctl 配置中将 net.bridge.bridge-nf-call-iptables 设置为 1
cat <
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sudo sysctl --system
使apt支持ssl传输
apt install -y apt-transport-https
下载gpg密钥
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
添加k8s镜像源
cat </etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF
安装
apt-get install -y kubelet=1.23.9-00 kubeadm=1.23.9-00 kubectl=1.23.9-00
Master节点执行
Kubeadm token create --print-join-command
将下面一串复制到node节点
成功
Ps:如果报错
Vim /etc/docker/daemon.json
输入命令
{"exec-opts": ["native.cgroupdriver=systemd"]}
然后重启docker跟kubelet
systemctl daemon-reload
systemctl restart docker
systemctl restart kubelet
重新初始化集群
sudo kubeadm reset
sudo kubeadm init
如果还报错,建议重启,然后记得再关一下swap