By default, CentOS will keep the 5 last installed kernels available. Since kernels are getting bigger and the /boot partition is, in most of the cases, a primary partition which is difficult to extent, you can run into problems like I had today. My /boot was getting too small.
I always create it with a size of 150M, but 250M is more common these days. The workaround is quite easy: limit the number of old kernels that you want to keep after installing a new one to 3 instead of the default 5.
Install the package yum-utils:
yum install yum-utils
Now remove the old kernels:
package-cleanup --oldkernels --count=2
To make this permanent, edit /etc/yum.conf and set installonly_limit:
That’s it. CentOS will now install no more than 3 kernels. The current one and two older versions. This also works with other RPM-based systems like Fedora and Redhat or Oracle Enterprise Linux.