在使用Kubernetes(k8s)时,很多用户可能会遇到各种各样的问题。其中之一就是在安装Calico网络插件时,可能会遇到如下报错信息:“MountVolume.SetUp failed for volume 'bpffs': hostPath type check failed: /sys/fs/bpf”。

        这个问题的根本原因在于Linux内核版本较低,无法支持Calico所需的某些特性。为了解决这个问题,一个有效的方法是升级Linux内核。以下是具体的解决步骤:

  小版本内核升级,此方法用于我这边测试虚拟机环境,生产慎用

  在执行升级之前,首先需要了解当前系统的内核版本。可以通过以下命令来查看:

uname -r

  在进行内核升级之前,请确保备份了重要的数据,以防万一发生意外情况。

   

  列出yum仓库的内核包版本,本次实践用的是阿里的镜像源

[root@jeven yum.repos.d]# yum list kernel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirrors.bfsu.edu.cn
Installed Packages
kernel.x86_64                                                              3.10.0-957.el7                                                                    @anaconda
Available Packages
kernel.x86_64                                                              3.10.0-1160.81.1.el7                                                              updates

直接更新内核版本,此方法适用于更新内核补丁。

[root@jeven yum.repos.d]# yum update -y kernel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                           | 8.5 kB  00:00:00     
 * epel: mirrors.bfsu.edu.cn
base                                                                                                                                           | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                               | 3.5 kB  00:00:00     
epel                                                                                                                                           | 4.7 kB  00:00:00     
extras                                                                                                                                         | 2.9 kB  00:00:00     
updates                                                                                                                                        | 2.9 kB  00:00:00     
(1/3): epel/x86_64/updateinfo                                                                                                                  | 1.0 MB  00:00:00     
(2/3): epel/x86_64/primary_db                                                                                                                  | 7.0 MB  00:00:01     
(3/3): updates/7/x86_64/primary_db                                                                                                             |  19 MB  00:00:09     
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-1160.83.1.el7 will be installed
--> Processing Dependency: linux-firmware >= 20190429-72 for package: kernel-3.10.0-1160.83.1.el7.x86_64
--> Running transaction check
---> Package linux-firmware.noarch 0:20180911-69.git85c5d90.el7 will be updated
---> Package linux-firmware.noarch 0:20200421-80.git78c0348.el7_9 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================
 Package                                 Arch                            Version                                               Repository                        Size
======================================================================================================================================================================
Installing:
 kernel                                  x86_64                          3.10.0-1160.83.1.el7                                  updates                           52 M
Updating for dependencies:
 linux-firmware                          noarch                          20200421-80.git78c0348.el7_9                          updates                           80 M

Transaction Summary
======================================================================================================================================================================
Install  1 Package
Upgrade             ( 1 Dependent package)

Total download size: 132 M
Downloading packages:
No Presto metadata available for updates
(1/2): kernel-3.10.0-1160.83.1.el7.x86_64.rpm                                                                                                  |  52 MB  00:00:31     
(2/2): linux-firmware-20200421-80.git78c0348.el7_9.noarch.rpm                                                                                  |  80 MB  00:00:48     
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                 2.7 MB/s | 132 MB  00:00:48     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : linux-firmware-20200421-80.git78c0348.el7_9.noarch                                                                                                 1/3 
  Installing : kernel-3.10.0-1160.83.1.el7.x86_64                                                                                                                 2/3 
  Cleanup    : linux-firmware-20180911-69.git85c5d90.el7.noarch                                                                                                   3/3 
  Verifying  : kernel-3.10.0-1160.83.1.el7.x86_64                                                                                                                 1/3 
  Verifying  : linux-firmware-20200421-80.git78c0348.el7_9.noarch                                                                                                 2/3 
  Verifying  : linux-firmware-20180911-69.git85c5d90.el7.noarch                                                                                                   3/3 

Installed:
  kernel.x86_64 0:3.10.0-1160.83.1.el7                                                                                                                                

Dependency Updated:
  linux-firmware.noarch 0:20200421-80.git78c0348.el7_9                                                                                                                

Complete!



重启服务器

reboot

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐