基础环境部署
k8s 集群 ip 规划
master1: 172.16.40.110/24
node1: 172.16.40.120/24
设置主机名 master
hostnamectl set-hostname master
设置主机名 node
hostnamectl set-hostname node
配置 主机名 解析
echo "172.16.40.110 master" >> /etc/hosts
echo "172.16.40.120 node" >> /etc/hosts
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
将 SELinux 设置为 permissive 模式
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
关闭 NetworkManager
systemctl disable --now NetworkManager
systemctl start network && systemctl enable network
删除原有 repo 源
rm -rf /etc/yum.repos.d/*
配置阿里云 repo 源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum install yum-utils -y
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum clean all && yum makecache
时间同步
yum install chrony -y
sed -i '/^server/d' /etc/chrony.conf
sed -i '1s;^;allow 172.16.40.0/24\n;' /etc/chrony.conf
sed -i '1s;^;local stratum 10\n;' /etc/chrony.conf
sed -i '1s;^;server master1 iburst\n;' /etc/chrony.conf
systemctl enable chronyd
systemctl restart chronyd
systemctl status chronyd
chronyc sources
End