Hello everyone, I am Derek, focusing on practical operations, cutting-edge technology analysis, and career growth stories. If you are interested in “practical operational skills”, “popular interpretations of new technologies”, or “real workplace advancement experiences”, feel free to follow and share, let’s avoid detours on the technical road together~
When deploying Kubernetes, Docker, Containerd, and Calico, you may have already discovered a reality:
No matter how new the container technology is, it cannot run faster than an outdated Linux kernel.
CentOS 7 defaults to the 3.10 kernel, and CentOS 8 defaults to the 4.18 kernel, both of which have significant limitations for capabilities like eBPF, OverlayFS, and IPVS. Therefore, it is essential to give the system a “stronger heart” before setting up a production cluster.
This article organizes the common kernel upgrade methods for CentOS 7 / CentOS 8 / Ubuntu, retaining only the steps that are truly useful in an enterprise environment.
1. CentOS 7: The Most Common Upgrade Scenario
CentOS 7 is the most common base environment for many internal clusters, but the built-in 3.10 kernel is clearly outdated. Fortunately, ELRepo provides stable long-term support (kernel-lt) and mainline updates (kernel-ml).
Below, we take kernel-lt as an example, which is suitable as a general choice for production environments.
1. Import the ELRepo GPG Key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
2. Install the ELRepo Repository
yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
3. Check Available Kernels
yum --enablerepo=elrepo-kernel list kernel*
4. Remove Old Version Tools (Mandatory)
yum remove -y kernel-tools kernel-tools-libs
This step must be performed before installing the new kernel-tools, otherwise there will be conflicts.
5. Install the Long-Term Support Kernel Version
yum --enablerepo=elrepo-kernel install -y kernel-lt kernel-lt-tools
kernel-tools must be installed simultaneously, otherwise the system tool version will not match the kernel.
6. Set the New Kernel as the Default Boot Option
Check the GRUB entries:
awk -F'\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
Set the default boot:
grub2-set-default 0
7. Reboot to Verify
reboot
uname -r
At this point, a stable new kernel is ready to support the new containerized infrastructure.
2. CentOS 8 / Rocky 8 / AlmaLinux 8
Compared to CentOS 7, the CentOS 8 series is much more modern, but some cloud-native features still rely on a higher version kernel, such as eBPF and some storage drivers. Therefore, ELRepo can still be used for upgrades.
1. Install ELRepo
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install -y https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
2. Install the Kernel (using kernel-ml as an example)
dnf --enablerepo=elrepo-kernel install -y kernel-ml
3. Set the Default Boot Option
grub2-set-default 0
4. Reboot and Check the Version
reboot
uname -r
3. Ubuntu (Recommended Official HWE Kernel)
Compared to manually installing the mainline kernel, the official HWE (Hardware Enablement) kernel provided by Ubuntu is more stable and better suited for production environments.
Execute the following commands to switch to the latest HWE kernel (Ubuntu will automatically select the appropriate 5.x or 6.x kernel based on the version):
sudo apt update
sudo apt install --install-recommends linux-generic-hwe-20.04
After rebooting, check:
uname -r
The HWE kernel includes Canonical’s official patches, making it more friendly to Kubernetes, container runtimes, and BPF series features, making it the preferred choice for enterprise environments.
In Conclusion
In the cloud-native ecosystem, many people focus only on Kubernetes, Docker, and CNI, while neglecting the most fundamental basis:the Linux kernel version determines how fast and stable you can run.
Upgrading to a stronger kernel is like giving your platform a stronger future.
ENDImportant Reminder
🔴 Because of your attention and feedback, sharing becomes more meaningful ❤️.
✨ If you want to see more heartfelt articles in the future, don’t forget to follow, light up recommendations, and encourage your friends together.