Unsupervised learning is one of the major research areas in machine learning, while kernel methods provide eficient solutions for various statistical learning problems. In this paper we propose a kernel based clustering algorithm that uses the Particle Swarm Optimization technique and discriminant functions. The method represents a general framework for solving the clustering problem: once an appropriate clustering validation index is chosen for a given class of datasets, the method performs very well in solving the problem. The method automatically detects the clusters in a given dataset and also, automatically estimates the number of clusters. Due to the use of kernel functions, our approach can be used for both linearly separable and linearly non-separable clusters. Since our algorithm uses the Particle Swarm Optimization technique, parallel computation may be used, if necessary. We evaluate our method on various datasets and we discuss its capabilities.