Knee pain is often complex and even the medical professionals will usually only give generic advice (unless of course something screams out at them on an MRI/ clinical examination/ etc).
My tips for happy knees would be:
1) Make sure you are as physiologically balanced as possible (i.e. not overusing or underusing specific muscles and ensuring muscle activation co-ordinates correctly for the given activity) and make sure there is no underlying pathology
2) Ensure the bike/ shoes/ cleats fit you properly
3) Get the right rest and recovery
4) Don't neglect stretching and flexibility. My all time favourite thing for my own achey knees is self-myofascial release or foam rolling to you and I
Knee pain is complex but often common sense things as above can really be helpful. Best of luck getting the knees sorted