Fog computing serves the delay-sensitive applications of the Internet of Things (IoT) in more efficient means than the cloud. The heterogeneity of the tasks and the limited fog resources make task scheduling a complicated job. This paper proposes a clustering based task scheduling algorithm. Specifically, the K-Means++ clustering algorithm is used for clustering the fog nodes. Randomized round robin, a task scheduling algorithm is applied to each cluster. The results show that the proposed algorithm reduces the system's average waiting time.