A lump over knee cap for such a long period is a matter of concern.
This most probably is a bursitis
., meaning inflammation of the bursa around the knee cap.
and pain that you are experiencing might be due to infection that has occurred in the already inflammed bursa.
Treatment is :
Get it aspirated and send the aspirate for pus culture and sensitivity test.
Get it properly drained and removed surgically and start antibiotic according to the culture report.