Thanks for your question.
Cross validation can be used for various purposes. As far as your question is concerned, you could probably use it for choosing the optimal value of k for KNN. For instance, you can run K fold for various values of k.For each value of k, compute the average cross validation error across K folds. You can then select the value of k with the best cross validation error.
Basically, you use cross-validation to avoid over fitting, by training the model on the training set and computing the model's performance on the validation set and repeating this for a few more times(K). The results are then averaged.
Hope this helps.
Thanks & Regards,