One approach is to parse the default kernel from GRUB configurations. The default GRUB menu entry can be detected, for example:
grep GRUB_DEFAULT /etc/default/grub | cut -d '=' -f 2
Then get the menu entries from GRUB config, like:
grep -A 15 '^menuentry' /boot/grub/grub.cfg | grep -o -P 'vmlinuz-\S+'
Source: How to get the kernel version of the next boot from a script – Unix & Linux Stack Exchange