#!/bin/bash set -e # 1. 關閉 swap sudo swapoff -a sudo sed -i '/ swap / s/^/#/' /etc/fstab # 2. 啟用橋接網路所需 kernel module + ip forward cat < /dev/null 2>&1; do echo " 尚未 ready,等待 5 秒..." sleep 5 done # 8. 安裝 Flannel CNI (Pod network) kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml echo "=== 安裝 containerd + kubeadm/kubelet/kubectl + 初始化 master + 安裝 Flannel 完成 ==="