If it occurs on the outside of the knee it’s likely ITB (iliotibial band). Assuming ITB, google “iliotibial band” & “iliotibial band stretches”. See your doctor & get started on Physical Therapy, if you can. In PT, they will work with you on stretches, balance, & strengthening areas that are weak. (For instance, you may have overdeveloped quads, but underdeveloped hamstrings or you may have an imbalance in your gait, such as pronating.) I’ve been following a strict stretching routine now for several months, along with icing after (10-15 mins on/off - 3 sessions). I’m also religious about taking Glucosomine/Chondroiten/MSM & gellatin, and I hike with poles. The past several weeks, I’ve been hiking 20+ mile weekends (back-to-back days), with 2k-3k elevation gain/loss, plus another 6 miles rt on flat surface to/from work twice/wk(25-lb pack) at full stride/speed. I also stretch throughout a hike, whenever I can (hams, quads, flexors). Though my ITB occasionally lets me know it’s there, I’d place the improvement over several months at >90%!!!
OregonHikerDave