From ffac1abfa45d90bd58a2d4af27a50b627c562cff Mon Sep 17 00:00:00 2001 From: ysh Date: Thu, 17 Jul 2025 09:31:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=85=A8=E5=AE=9E=E7=8E=B0k8sGPU?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/k8s_install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/script/k8s_install.sh b/script/k8s_install.sh index a0ad0a3..ab0d7ab 100644 --- a/script/k8s_install.sh +++ b/script/k8s_install.sh @@ -349,6 +349,13 @@ EOF # 重启 containerd systemctl restart containerd + + # 严格匹配完整的环境变量行,避免误判注释或其他行 + grep -qxF 'export PATH=/usr/local/cuda/bin:$PATH' ~/.bashrc || echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc + grep -qxF 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' ~/.bashrc || echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc + [[ "$-" == *i* ]] && source ~/.bashrc || echo "请执行: source ~/.bashrc" + nvcc -V || echo "CUDA 未安装或路径配置错误" + log_info "nvidia-container-runtime 配置完成,containerd已重启" fi else