Linux kernel upgrade docker+k8s update graphics card driver

Official driver | NVIDIA downloads the corresponding graphics card driver from this link

  1. # Uninstall the old nvidia driver that may exist (if you have not installed it, you can skip it, it is recommended to execute it)
    sudo apt-get remove --purge nvidia*
    # The dependencies required to install the driver
    sudo apt-get install dkms build-essential linux-headers- generic

sudo vim /etc/modprobe.d/blacklist-nouveau.conf

# Add the following content to the file blacklist-nouveau.conf:
 blacklist nouveau
 blacklist lbm-nouveau
 options nouveau modeset=0
 alias nouveau off
 alias lbm-nouveau off
 
# disable nouveau kernel module
echo options nouveau modeset=0 | sudo tee -a /etc /modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
# restart
reboot

# Close the graphical interface after a successful restart (if there is no graphical interface, this step will not be executed)
sudo service lightdm stop
# Switch to the graphics card driver file directory
cd /home
# Set permissions
sudo chmod +x NVIDIA-Linux-x86_64-535.86.05. run
# Install the driver
sudo ./NVIDIA-Linux-x86_64-535.86.05.run
# BIOS options will appear, the first one is selected by default

# After the installation is complete, restart to check whether it is successful
reboot
nvidia-smi

If you want k8s to recognize graphics card resources, you also need to install docker2 

If you encounter a dns error, modify the namespace in /etc/resolv.conf to 8.8.8.8

# 1
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
# 2
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
# 3
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
# 4
sudo apt-get update
# 5
sudo apt-get install nvidia-docker2
# 6-重启k8s
systemctl restart kubelet

Guess you like

Origin blog.csdn.net/xiaofeixia666888/article/details/132020326