Compare commits
2 Commits
10c1f0c268
...
9a4d10e93c
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a4d10e93c | |||
|
|
e8b53ad16f |
@ -471,14 +471,6 @@ chown -R root:root $nfs_share_path/containerd $nfs_share_path/kubelet $nfs_share
|
||||
|
||||
log_info "K8s数据目录迁移完成,所有数据将存储于$nfs_share_path下。"
|
||||
|
||||
# 判断是主节点还是副节点
|
||||
if [ "$1" == "master" ]; then
|
||||
# 写入hosts
|
||||
# if ! grep -q "k8s-master" /etc/hosts; then
|
||||
# echo "127.0.0.1 k8s-master" | sudo tee -a /etc/hosts > /dev/null
|
||||
# fi
|
||||
# 修改主机名,这里假设新主机名为 k8s-node,可根据实际情况修改
|
||||
hostnamectl set-hostname k8s-master || log_error "修改主机名失败"
|
||||
# 防火墙开放端口
|
||||
log_info "开放防火墙端口..."
|
||||
# 安装并配置 ufw(仅开放必要端口)
|
||||
@ -502,6 +494,16 @@ if [ "$1" == "master" ]; then
|
||||
sudo ufw allow 80/tcp
|
||||
sudo ufw allow 443/tcp
|
||||
# sudo ufw enable
|
||||
|
||||
# 判断是主节点还是副节点
|
||||
if [ "$1" == "master" ]; then
|
||||
# 写入hosts
|
||||
# if ! grep -q "k8s-master" /etc/hosts; then
|
||||
# echo "127.0.0.1 k8s-master" | sudo tee -a /etc/hosts > /dev/null
|
||||
# fi
|
||||
# 修改主机名,这里假设新主机名为 k8s-node,可根据实际情况修改
|
||||
hostnamectl set-hostname k8s-master || log_error "修改主机名失败"
|
||||
|
||||
# 主节点安装步骤
|
||||
log_info "正在master节点进行安装core和初始化"
|
||||
# kubeadm config images list
|
||||
@ -542,8 +544,8 @@ if [ "$1" == "master" ]; then
|
||||
kubectl apply -f /opt/components.yaml || log_error "本地安装MetricsServer插件失败"
|
||||
# log_info "正在安装Ingress-nginx-controller插件"
|
||||
# kubectl apply -f /opt/ingress-nginx-controller.yaml || log_error "本地安装ingress-nginx-controller插件失败"
|
||||
log_info "正在安装GPU模式必要插件"
|
||||
kubectl apply -f /opt/nvidia-device-plugin.yml || log_error "本地安装GPU模式必要插件失败"
|
||||
# log_info "正在安装GPU模式必要插件"
|
||||
# kubectl apply -f /opt/nvidia-device-plugin.yml || log_error "本地安装GPU模式必要插件失败"
|
||||
log_info "正在安装nfs-client-provisioner插件"
|
||||
aptitude -y install nfs-kernel-server nfs-common=1:1.3.4-2.5ubuntu3.7
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
@ -188,8 +188,9 @@ verify_perfect_cleanup() {
|
||||
|
||||
# 2. 验证命令无残留
|
||||
green_echo "2. 验证命令无残留..."
|
||||
local cmds=(kubectl kubeadm kubelet containerd docker etcd)
|
||||
local cmds=(kubectl kubelet containerd docker etcd kubeadm)
|
||||
for cmd in "${cmds[@]}"; do
|
||||
sleep 1 # 确保命令列表更新
|
||||
if command -v "$cmd" &> /dev/null; then
|
||||
red_echo " ❌ 命令 $cmd 仍存在"
|
||||
is_perfect=false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user