Thought I'd add my 2 penn'orth.
Did my right knee in 20 years ago doing yoga
mad
and after about 3 years I couldn't crouch or kneel. Sports physio diagnosed torn cartilage; had it done, everything ok again for 3 or 4 years, when it had to be redone, and so on, until I'd had 4 ops in 10 years. Then, 9 years ago, I was in an accident in which I nearly lost my right leg altogether, and in which knee problems were the least of the bother.
Finally got rid of rods, plates etc after years of ops and aggro, and now have permanent limp with one leg shorter than the other. The dodgy knee has stood up to all this very well however, and cycling is still easier than walking, by a long way.
I reckon 2 key things to preserving knees are what others have already said:
1. High cadence in a lowish gear, rather than pushing away on a higher gear in the feeling that it's harder work so must be doing you good. I know everyone has their own natural pedalling cadence just as they have a natural walking pace - the trick is to match cadence and gear so it's reasonably effortless (other than hill-climbing of course
).
2. Use pedals that allow you to twist your feet around on the pedals a bit. I've always had a tendency to turn one foot in more than the other when pedalling, it;'s just what feels most comfortable. I've used Shimano double-sided pedals for ages. They're good because you can ride in civvy shoes as well as cycling ones, and the SPD clip system allows enough adjustment to provide a reasonable range of float without being too loose.
The final, crucial point is to have the saddle at the correct height and in the correct relation to the bars and pedals - i.e. not too far back or forwards and at a height that allows almost full extension of the leg. Anything less and you end up putting far too much strain through the knee joint. I reckon at least half the people I see on bikes have the saddle too low. I can understand it for kids - feeling of safety, but its bad news for adults.
Here endeth the lesson...........