Could be lots of things, inflamed fat pad, tendonitis, poorly tracking kneecap, chondromalacia...
Doc will take an x-ray, guess, tell you to rest.
It probably won't help once you resume.
Then they might order an MRI, which is a better diagnostic.
Personally, what helped my knee is specific stretching, daily use of Penetrex, swapping out my road double for a compact.
It's been 18 months, and I'm finally able to push hard in the mountains again.
What ruins my knee is regular use of ibuprofen, advil, aleve, or any pain reliever. It seems to impair healing and recovery after riding. Everyone is different though.