Knee problem prevention?

Lately I’ve had some issues with my right knee: often(every few days on average) I’ll feel a tightness or misalignment or something that feels like something would snap, crackle, or pop if i didn’t eeeeaaaase off it and gently put my leg in a good position. And it’s not like I do anything that’s even a little contorting, or I try not to: I just get a little off somehow and my knee seriously feels like it’s on the verge of getting hurt, bad. Just standing around.

A shamefaced admission: I’m not training my legs at all. Except for riding a bike and not much at that, I’m woefully out of shape(yes I know). It occurred to me that maybe I have a muscle weakness/imbalance and was thinking of putting the clips on(padals with toeclips and straps). I used to ride like that all the time w/ no problems.

My question is if anyone can suggest or point me to something I can do that will prevent the injury that seems to be looming. I did once have a pretty serious alignment problem that a chiro helped me with, but this doesn’t feel exactly like that–that was actually a hip issue. Then again, maybe my hip is again off-kilter and I’m subconsiously “compensating” which puts my knee in an awkward position.

So: exercises, things to do(or avoid?). I try not to walk down stairs(up seems ok) becasue it bothers my–don’t know the name, but the tendon in front of the leg right above the knee. This is also a recent development. I don’t know if this is related or not.

Thanks for any info you guys can give me.