基础环境相关配置
1.服务器相关信息
| IP地址 | 角色 | 操作系统 |
|---|---|---|
| 172.17.240.73 | master1、etcd | CentOS 7.6.1810 |
| 172.17.240.74 | master2、etcd | CentOS 7.6.1810 |
| 172.17.240.75 | node1、ingress-nginx-controller | CentOS 7.6.1810 |
| 172.17.240.76 | node2、ingress-nginx-controller | CentOS 7.6.1810 |
| 172.17.240.68 | nginx1、Keepalived | CentOS 7.6.1810 |
| 172.17.240.69 | nginx2、Keepalived | CentOS 7.6.1810 |
| 172.17.240.70 | Keepalived VIP | CentOS 7.6.1810 |
2.添加hosts文件
172.17.240.73 master1
172.17.240.74 master2
172.17.240.75 node1
172.17.240.76 node2
172.17.240.68 nginx1
172.17.240.69 nginx2
3.关闭firewalld、selinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
4.关闭swap
swapoff -a
yes | cp /etc/fstab /etc/fstab_bak
cat /etc/fstab_bak |grep -v swap > /etc/fstab
5.添加内核参数
echo """
vm.swappiness = 0
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_nonlocal_bind = 1
net.ipv4.ip_forward = 1
""" > /etc/sysctl.d/k8s.conf
执行命令使修改生效
modprobe br_netfilter
sysctl -p /etc/sysctl.d/k8s.conf
6.安装基础软件包
yum -y install epel-release vim tree ntpdate wget net-tools telnet
7.同步时间
ntpdate -u ntp.api.bz