QGIS 3.4 adds a native "k-means clustering" algorithm. Based on a port of PostGIS' ST_ClusterKMeans function, this algorithm adds a new cluster ID field to a set of input features which identifies the feature's cluster based on a k-means clustering approach. If non-point geometries are used as input, the clustering is based off the centroid of the input geometries.