准备工作(三台机器都操作)

Kubernetes集群部署_k8s

关闭防火墙firewalld、selinux

systemctl disable firewalld
systemctl status firewalld
vi /etc/selinux/config
找到这一行:
SELINUX=enforcing
并将其更改为:
SELINUX=disabled
检查 SELinux 当前的工作模式:
sestatus
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.

设置主机名

临时更改主机名:
你可以使用 hostnamectl 命令来临时更改主机名,这个更改将在系统重启后失效。
sudo hostnamectl set-hostname your_new_hostname
例如,如果你想将主机名设置为 myrockyhost,命令如下:
sudo hostnamectl set-hostname myrockyhost
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.

设置/etc/hosts

vi /etc/host
192.168.11.250   linux01
  • 1.
  • 2.

Kubernetes集群部署_k8s_02

设置静态ip 

vi /etc/sysconfig/network-scripts/ifcfg-ens33
  • 1.

关闭swap

swapoff -a
永久关闭,vi /etc/fstab 注释掉swap那行
  • 1.
  • 2.

将桥接的ipv4流量传递到iptables链

modprobe br_netfilter ##生成bridge相关内核参数
cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system # 生效
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.

打开端口转发

echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p
  • 1.
  • 2.

时间同步

yum install -y chrony;
systemctl start chronyd;
systemctl enable chronyd
  • 1.
  • 2.
  • 3.

2)安装containerd(三个节点上操作)

先安装yum-utils工具

yum install -y yum-utils
  • 1.

Kubernetes集群部署_k8s_03