A variety of things for knee pain, some of which may or may not work for you:
- if you are overweight, lose weight. Easier said than done, but to me it seems logical that moving 100 kg of body (on a bicycle or walking) is going to put more strain on joints than moving 80 kg. Covid lockdowns were very restrictive here in France, during the first one we were limited to just 1 hour of exercise and a maximum perimeter of 1 km (basically that meant no cycing at all). So a lot of people, including myself, spend more time eating and much less time than usual doing exercise. My weight went up to 89 Kg, I am now back down to 80 Kg, which feels much better for both walking and cycling.
- make sure you drink enough liquid, especially in hot weather (but not alcohol!).
- eat healthily. In general, a varied diet should provide all the vitamins and minerals to keep the knee joints in good condition. As a precaution I added two supplements when I did an ambitious tour at 55 years of age - one cod liver oil capsule a day for vitamins and fatty acids plus extra salt to avoid cramps. I am pretty sure the salt worked for me, not so much for the cod liver oil, but I don't think it did any harm.
- keep your knees warm. I had a serious bout of knee pain about 40 years ago after riding in cold, wet jeans.
- don't force hard on hills, drop to a low gear and slow down, get off and push if you don't have a low enough gear to feel comfortable.
- use low gears and "spin" at high revs rather than "mash" at low revs. This works for me, but may not suit others.
- use short cranks. This is controversial, but works very well for me. With 150 mm cranks I can spin at higher revs, and go just as fast as I did before when I used 170 mm cranks. The force applied to the pedals is less for the same power output, this is also true for the knee joints.
- build up your cycling very gradually. If 17 miles is too much, start by doing very short distances, say 5 miles on the flat, but do it several times a week until you can increase the distance without discomfort. I find it much easier to motivate myself if my cycling has a purpose - shopping, visit to the library, picnic etc.
And alternate with walking or some other exercise. Swimming is supposed to be very good but is something I dislike, so I don't do it myself.