NVIDIA 驱动升级指南:570 → 580(RHEL8 / CentOS8)

一、背景说明

本文档记录将 NVIDIA GPU 驱动从 570.148.08 升级至 580.95.05 的完整操作流程。

二、准备工作

  1. 准备好完整的操作文档,(卸载、重启、下载、安装、重启,验证)
  2. 禁止调度节点,驱逐已有的 Pod,验证不存在业务 pod

三、操作流程

3.1 卸载驱动

1
/usr/bin/nvidia-uninstall

运行 NVIDIA 官方卸载工具,交互式移除通过 .run 文件安装的旧版驱动(570.148.08)。该工具会自动清理驱动模块、库文件及相关配置。

  1. 备份 X screen 的配置文件(默认 no,保持默认)

    If you plan to no longer use the NVIDIA driver, you should make sure that no X screens are configured to use the NVIDIA X driver in your X configuration file. If you used nvidia-xconfig to configure X,
    it may have created a backup of your original configuration. Would you like to run nvidia-xconfig --restore-original-backup to attempt restoration of the original X configuration file?

    如果您计划不再使用 NVIDIA 驱动程序,请确保您的 X 配置文件中未配置任何 X 屏幕使用 NVIDIA X 驱动程序。如果您曾使用 nvidia-xconfig 来配置 X,
    它可能已为您原始的配置文件创建了备份。您是否希望运行 nvidia-xconfig --restore-original-backup 来尝试恢复原始的 X 配置文件?

备份  的配置文件

  1. 等待卸载过程(很快)

等待卸载过程

  1. 未能删除部分目录的告警

    WARNING: Failed to delete some directories. See /var/log/nvidia-uninstall.log for details.

    警告:未能删除部分目录。详情请参阅 /var/log/nvidia-uninstall.log。

未能删除部分目录的告警

  1. 继续等待卸载过程

继续等待卸载过程

  1. 卸载完成的提示

    Uninstallation of existing driver: NVIDIA Accelerated Graphics Driver for Linux-x86_64 (570.148.08) is complete.

    现有驱动程序卸载完成:NVIDIA Linux-x86_64 加速图形驱动程序 (570.148.08)。

卸载完成的提示

3.2 重启

推荐先重启,否则会有占用 GPU 的模块,安装时无法通过检查,虽可以强制安装,但会引入不确定性。

自检不通过提示

Would you like to continue installation and skip the sanity checks? If not, please abort the installation, then close any programs which may be using the NVIDIA GPU(s), and attempt installation again.

您是否要继续安装并跳过完整性检查?如果不想继续,请中止安装,然后关闭所有可能正在使用 NVIDIA GPU 的程序,并重试安装。

自检不通过提示

3.3 安装驱动

NVIDIA驱动下载官网

  1. 下载新驱动(从 NVIDIA 官方源下载 580.95.05 版本的 Linux 驱动安装包。)
1
wget https://download.nvidia.com/XFree86/Linux-x86_64/580.95.05/NVIDIA-Linux-x86_64-580.95.05.run
  1. 添加可执行权限
1
chmod +x NVIDIA-Linux-x86_64-580.95.05.run
  1. 安装新版驱动
1
./NVIDIA-Linux-x86_64-580.95.05.run -no-x-check -no-nouveau-check -no-opengl-files
  • -no-x-check:跳过 X Server 运行检测,适用于无图形界面的服务器环境
  • -no-nouveau-check:跳过开源 Nouveau 驱动冲突检测(生产服务器通常已禁用)
  • -no-opengl-files:不安装 OpenGL 相关文件,避免与系统自带的 Mesa 库冲突,服务器场景推荐

3.4 重启

服务器禁用reboot命令的时候,可以 vi 一个脚本。

1
reboot

四、验证

  1. 查询驱动版本
1
nvidia-smi
  1. 编写 yaml ,临时启动 pod 测试。
1
vim gpu-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
apiVersion: v1
kind: Pod
metadata:
name: gpu-test
spec:
restartPolicy: Never
nodeSelector:
kubernetes.io/hostname: <hostname的主机名>
tolerations:
- key: node.kubernetes.io/unschedulable
operator: Exists
effect: NoSchedule
containers:
- name: cuda-test
image: nvidia/cuda:12.4.1-base-ubuntu22.04
command: ["sh", "-c"]
args:
- |
echo "=== 驱动信息 ===" && \
nvidia-smi && \
echo "" && \
echo "=== GPU 详细信息 ===" && \
nvidia-smi --query-gpu=name,driver_version,compute_cap,memory.total --format=csv && \
echo "" && \
echo "=== 持续观察用,60秒后自动退出 ===" && \
sleep 60
resources:
limits:
nvidia.com/gpu: 1

​ 验证

1
2
kubectl apply -f gpu-test.yaml
kubectl logs -f gpu-test

​ 删除测试 pod

1
kubectl delete -f gpu-test.yaml