Did your instructor attempt to correct your set-up? If so...and it still didn't work, 1)maybe your instructor is not knowledgable enough on correct set ups...and in that case, try another class with a different instructor, or 2), were you using really high resistance levels or, little to no resistance and high cadences? It could be that you are working at levels that are causing too much stress on your knees due to the above mentioned issues.
Another problem could result from whether you use clip in or not. Oftentimes the bikes have clips that are set too tight and if your bike shoes don't allow for some float, you knees will be in a precarious position.
I would ask your instructor for another look at your set-up (and show up early enough for them to give you some extra attention).
I hope you get this resolved.
Vertically challenged, but expanding my horizons.