With the rapid increase in the number of mobile devices connected to the Internet in recent years, the network load is increasing. As a result, there are significant delays in the delivery of cloud resources to mobile users. Edge computing technologies (edge, cloudlet, fog computing, etc.) have been widely used in recent years to eliminate network delays. This problem can be solved by allocating cloud resources to the cloudlets that are close to users. The article proposes a clustering-based model for the optimal allocation of cloud resources among cloudlets. The proposed model takes into account user activity, usage frequency of cloud resources, the physical distance between users and cloud resources, as well as the storage capacity of cloudlets for optimal allocation of cloud resources in cloudlets. The proposed model was formalized as a constrained k-means method and an algorithm was developed to solve it. The MATLAB 2022a toolkit was used to evaluate the efficiency of the proposed algorithm. The obtained results revealed that the algorithm is promising.