What is the proper method to remove old kernels from a Red Hat Enterprise Linux system?

Red Hat Enterprise Linux 8

The YUM version 4 (based on the upstream DNF project) method for removing kernels and keeping only the latest version and running kernel:

1
$ yum remove --oldinstallonly

From the yum man page:

1
2
3
dnf [options] remove --oldinstallonly
Removes old installonly packages, keeping only latest versions and version of running
kernel.