My answer is a lot simpler than all the good advice above. Knee pain comes from too weak muscles. You don't use those muscles on street rides. where there is no muscle, your joints and bones do the work. my knee pain is gone as soon as i do a few events, or if i spent the winter in the gym, i got no knee (or much other pain) at all. This was explained to me in other sports and it applies directly to track riding. So, get a lot of exercise. Legs and core!
I used to take ibu, but i was told and explained by ortho that taking ibu is the exact opposite of what you want to do. when muscles inflame, they are building up. If you always take anti inflammatory, you will never build up your muscles and all the work was for nothing. I stopped taking ibu and I'm fine after the first event.