Thanks for your query.
Crams in the knee/knee caps may be due to dehydration
as told by your doctor. It can be manifestation of decreased calcium level in the blood, decreased potassium level in the blood or due to spinal pathologies.
I think you must check your blood level of these and have a MRI
of lumbosacral spine to have a proper diagnosis..
Do meet your doctor with these reports