The K-medoids clustering algorithm is realized by a P system in this paper. Because the membrane system has great parallelism and lower computational time complexity, it is suitable for solving combinatorial problems like the clustering problem. A P system with all the rules to solve the K-medoids algorithm was constructed. The specific P system is associated with the dissimilarity matrix between n objects. This system can get one possible classifications in a non-deterministic way. Through example test, it is appropriate for cluster analysis. This is a new attempt in applications of membrane system and it provides new ideas and methods for cluster analysis.