一、環境準備
叢集角色 |
主機名 |
作業系統 |
IP地址 |
核心 |
Master |
k8s-master |
CentOS Linux release 7.9.2009 (Core) |
172.16.99.71 |
3.10.0-1160.119.1.el7.x86_64 |
Node |
k8s-node01 |
CentOS Linux release 7.9.2009 (Core) |
172.16.99.72 |
3.10.0-1160.119.1.el7.x86_64 |
Node |
k8s-node02 |
CentOS Linux release 7.9.2009 (Core) |
172.16.99.73 |
3.10.0-1160.119.1.el7.x86_64 |
1、清空iptables 預設規則
iptables -F
2、關閉selinux
setenforce 0
3、關閉swap交換分割槽
swapoff -a
4、設定主機名
hostnamectl set-hostname k8s-master
hostnamectl set-hostname k8s-node01
hostnamectl set-hostname k8s-node02
5、配置核心引數
sudo modprobe bridge
sudo modprobe br_netfilter
sysctl net.bridge.bridge-nf-call-ip6tables=1
sysctl net.bridge.bridge-nf-call-iptables=1
echo "net.bridge.bridge-nf-call-ip6tables=1" >> /etc/sysctl.d/k8s.conf
echo "net.bridge.bridge-nf-call-iptables=1" >> /etc/sysctl.d/k8s.conf
6、安裝docker
wget -c https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
yum install -y docker-ce-24.0.0