COOKBOOK-Kubernetes二进制高可用部署-准备
Views:
1000000
Words:
329
Read time:
1 mins.
版本说明
- kubernetes:1.31.2
- containerd:1.7.7
- etcd:3.5.14
- nerdctl:1.7.7
虚拟机信息
- IP
- 192.168.56.109,hostname:centos1
- 192.168.56.110,hostname:centos2
- 192.168.56.111,hostname:centos3
- 操作系统:CentOS7
- 内核版本:3.10.0
系统准备
所有虚拟机禁用swap虚拟内存
1 2 3 4 5 6 7 8
| free -h
swapoff -a
sed -i 's/.*swap.*/#&/' /etc/fstab
free -h
|
所有虚拟机禁用SELinux
1 2 3 4 5 6 7 8
| getenforce
setenforce 0
sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
getenforce
|
所有虚拟机关闭防火墙
1 2 3
| systemctl stop firewalld systemctl disable firewalld
|
所有虚拟机开启ipv4转发内核能力
1 2 3 4 5 6 7 8 9 10
| cat << EOF > /etc/sysctl.d/k8s-sysctl.conf net.ipv4.ip_forward = 1 EOF
sysctl -p /etc/sysctl.d/k8s-sysctl.conf
sysctl -a |grep ipv4.ip-forward
|
所有虚拟机配置host
1 2 3 4 5
| cat << EOF >> /etc/hosts 192.168.56.109 centos1 192.168.56.110 centos2 192.168.56.111 centos3 EOF
|
所有虚拟机安装必要工具
1
| yum install -y net-tools tree wget
|
(•̀ᴗ•́)و ̑̑