In general, a discrete (1D) transform can be defined as:
$$ y[k] = \sum_n \phi[k,n] x[n] $$
where the input function $x[n]$ is mapped into the output function $y[k]$, by the kernel, $\phi[k,n]$, of the transform. For example, the kernel for DFT (discrete Fourier transform) is $\phi[k,n] = e^{-j \frac{2\pi}{N}kn}$.
In essence the kernel acts on the input and produces the output by modifying it, like in the sum above. Therefore the kernel defines the character of the mapping.
Programmatically, a kernel is the core portion of a function which accepts a sequence as its input and returns a computed output whan called.
The input-output relationship for a discrete-space 2D LTI system (typically an image filter) is expressed as a convolution sum :
$$ y[n_1,n_2] = \sum_{k_1=-\infty}^{\infty} \sum_{k_2=-\infty}^{\infty} h[n_1-k_1, n_2-k_2]x[k_1,k_2] $$
The convolution operation is similar to the transform considered above with its kernel being the impulse response $h[n_1, n_2]$ of the LSI system.
For a discrete-time 2D LSI system whose impulse reponse $h[n_1, n_2]$ has a finite domain of support; i.e, finite size, then programmatically the system can be represented as a matrix as well. And the convolution operation than is performed by calling a function which contains the impulse response matrix as its kernel and producing the output pixels per call. And here is the most typical meaning of a (filter) kernel in image processing.
Furthermore, a matrix called mask operates on a block of pixels (sample wise) on the image being processed. They are more of a programming concept than of signal processing, but also find applications such as windowing or frequency domain filtering. Masks find extensive usage for image processing effects. Their operating matrix can also be called as a kernel.