Hydration also plays a small part in joint pain. Be sure you are always well hydrated.
Anytime on a bike that I felt any inkling of a pain in my knees, I'd be sure to drink more as well as shift to an easier gear. For a while I was working as a machinist and stood for eight and a half hours a day. Anytime I felt a back ache coming on I'd guzzle down a bottle of water. The pain was gone before it ever became an issue.