Knee pain - as you see from the above posts - causes, and cures, are multiple. It can be caused by too much cycling stress, or too little strength. It can be caused by riding position, or foot position, or crank length.
However, you can step through a series of different "cures" to find what works.
1. First rule is, if it hurts, rest it. Couple weeks, try again. In your case, I think we can say you've tried this.
2. Foot position: if you are using cleats, get a good bike fitter to check your bike and shoe position. This alone could fix your issues.
3. Third thing I would say is spin. Get a computer that gives you cadence, and never go below 85. Never. If you are going up a hill and go below 85, walk. If, after a month to 6 weeks, you see improvement, you can slide the cadence down occasionally, but not less than 75. After 6 months, you might have enough soft tissue strength improvement to go outside this. The key here is light pedaling, and plenty of it. I've seen people rehabilitate trashed knees this way. You could be causing the pain by pushing too hard (low cadence, pushing hard) on the pedals. That is a sure way to hurt yourself.
4. You might actually benefit from a weight routine. If you go this route, high reps/low weight is usually the correct path, not low reps/high weight.
5. This might be higher, but I don't think knee pain is often related to flexibility. However, yoga and similar stretching exercises are very important. Flexibility strengthens the soft tissues. Yoga and other "core" exercises can help balance muscle groups as well. Unbalanced muscle groups are more likely to cause back pain or muscle stress, but you can see it manifest in odd ways. Atypical, but possible.
The knee is a complicated joint, with a lot of stuff going on. Be cautious until you find things that help. If it hurts, stop doing it. It could be as simple as you overstressing the joint on that first hill outside your house, and not resting it enough to recover. Spinning and light weight reps will help to strengthen connecting tissue for a long term solution.