Here you can find, from a theoretical point of view, how it is possible to use the kernel trick on the k-means algorithm to detect clusters that are not linearly separable:
https://drive.google.com/file/d/1IIKrC3oJxw4e7FWefF4wHSFznKYJs1wD/view?usp=sharing