I had the same problem... my cleats were not adjusted properly on my pedals... and I was mashing my pedals... vs. spinning... and BAM... I had some accute knee pain!

The pain would get so bad in my left knee... I would have to remove my foot from the pedal and only pedal with my right foot!

To fix the issue... I... did the following:

First thing I did was get SpeedPlay pedals... with the float on the pedal, I didn't have to worry about the proper adjustment. Now, my foot settles where it wants to naturally.

Then... I rode my bike... just very slow... and spinning the whole way. Which reminds me... I learned how to use my gears and how to spin! I also iced down my knees on a regular basis.

After about 1.5 months, I was back to new! In fact, I never have knee pain on my bike!

Good luck on fixing your knee pain!