kubeadm 安装 k8s 集群前置操作

共计 724 个字符,预计需要花费 2 分钟才能阅读完成。

关闭防火墙:

systemctl stop firewalld && systemctl disable firewalld

关闭selinux:

sed -i 's/enforcing/disabled/' /etc/selinux/config  # 永久
setenforce 0  # 临时

关闭swap:

swapoff -a  # 临时
sed -ri 's/.*swap.*/#&/' /etc/fstab  # 永久

转发 IPv4 并让 iptables 看到桥接流量 

cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF

sudo modprobe overlay
sudo modprobe br_netfilter

# sysctl params required by setup, params persist across reboots
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables  = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward                 = 1
EOF

# Apply sysctl params without reboot
sudo sysctl --system
iptables -P FORWARD ACCEPT

重启 containerd

systemctl daemon-reload && systemctl restart containerd 

参考链接

  1. https://kubernetes.io/zh-cn/docs/setup/production-environment/container-runtimes/
正文完
 0
评论(没有评论)