44-k8s-高可用集群-内核升级
2022-03-13 本文已影响0人
紫荆秋雪_文
3.10内核在大规模集群具有不稳定性,所以需要升级内核
一、内核升级流程
查看内核版本
uname -sr
0、升级软件包,不升级内核
yum update -y --exclude=kernel*
1、下载公钥
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
3、安装镜像加速
yum install -y yum-plugin-fastestmirror
4、仓库启用后,列出可用的内核相关包:
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
- kernel-lt: long term support:长期支持版
- kernel-ml: mainline stable: 主线稳定版
5、选择自己的版本进行安装 5.4.184-1.el7.elrepo
yum --enablerepo=elrepo-kernel install -y kernel-lt
6、再次查看内核
uname -sr
Linux 3.10.0-1160.53.1.el7.x86_64
并没有升级
7、查看内核位置
awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
- 结果
CentOS Linux (5.4.184-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux (3.10.0-1160.53.1.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-20220208145000711038896885545492) 7 (Core)
8、重新创建内核配置
grub2-mkconfig -o /boot/grub2/grub.cfg
- 确认内核的位置,修改默认内核即可
CentOS Linux (5.4.184-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux (3.10.0-1160.53.1.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-20220208145000711038896885545492) 7 (Core)
9、修改使用默认内核
vi /etc/default/grub
- 将 GRUB_DEFAULT 设置为 0,代表 GRUB 初始化页面的第一个内核将作为默认内核
10、再重新整理下内核
grub2-mkconfig -o /boot/grub2/grub.cfg
11、重开机
reboot
12、检查
uname -r