rke2
安装RKE2,请按顺序安装.
分别在三台节点上设置hostname
hostnamectl set-hostname node01 && bash
hostnamectl set-hostname node02 && bash
hostnamectl set-hostname node03 && bash
在三台节点上设置hosts
cat >> /etc/hosts << EOF
192.168.123.131 node01
192.168.123.132 node02
192.168.123.133 node03
EOF
关闭三台节点上的防火墙
systemctl stop firewalld
systemctl disable firewalld
关闭三台节点上的selinux
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
#重启生效
关闭三台节点上的swap分区
swapoff -a
sed -ri 's/.*swap.*/#&/' /etc/fstab
配置三台节点上的仓库文件
curl -o /etc/yum.repos.d/Centos-7.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
在三台节点上安装必要的软件
yum install -y ntpdate vim wget tree httpd-tools telnet lrzsz net-tools bridge-utils unzip
yum clean all && yum makecache
同步三台节点的时区和时间到上海时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate -u ntp.aliyun.com && date
#上面不能用的话用下面的
sudo yum -y install ntpdate
sudo ntpdate ntp1.aliyun.com
sudo systemctl status ntpdate
sudo systemctl start ntpdate
sudo systemctl status ntpdate
sudo systemctl enable ntpdate
修改三台节点的内核参数
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
加载br_netfilter网络过滤器模块
modprobe overlay
modprobe br_netfilter
sysctl命令动态修改内核参数
sysctl -p /etc/sysctl.conf