offline-kubernetes-install/init/init.sh

35 lines
661 B
Bash
Raw Normal View History

2023-09-12 17:20:40 +08:00
#!/bin/bash
2023-09-12 17:28:07 +08:00
set -euo pipefail
2023-09-12 17:20:40 +08:00
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script"
exit 1
fi
systemctl disable --now firewalld
2023-04-26 19:57:49 +08:00
setenforce 0
sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sudo sysctl --system
2023-08-22 18:54:45 +08:00
# 关闭swap
2023-09-12 17:20:40 +08:00
swapoff -a
2023-08-22 18:54:45 +08:00
sed -i 's/.*swap.*/#&/' /etc/fstab
2024-01-30 15:56:17 +08:00
yum install -y ./*.rpm
2023-09-12 17:40:05 +08:00
cd ../docker && bash ./install.sh && cd -
cd ../kubeadm && bash ./install.sh && cd -
2023-09-13 22:36:44 +08:00
cd ../flannel && bash install.sh
2023-04-26 19:57:49 +08:00