Simply put, there should be no pain in yoga. If there is, whatever you are doing should be discontinued. Some alignment issues to consider with padmasana. It requires a great deal of external rotation in the hip socket. If the knees hurt, you are transferring the rotation to the knees and the knees are not designed to take this force. Standing poses such as Warrior II, Trikonasana, Utthita Parsvakonasana and any supine hip openers like Supta Ardha Padmasana (thread the needle), Gomukhasana, Agnisthambasana will help with external rotation. Ray Long (Daily Bandha and The Key Poses of Yoga books) suggests the Cradle stretch. You can google that for a tutorial. It’s a good one! Once you have gained that external rotation, try ardha padmasana first to see how comfortable it feels. Ahimsa is also very important to practice as you approach padmasana (as well as any asana) Listen to your body and your inner voice. You will know when the time is right to try padmasana again.
And remember trying to “achieve” padmasana goes against the final Niyama of Iswara Pranidhana. Achieving is result oriented (ego driven) and does not allow you to fully surrender to Divine. The mind remains agitated and meditation is nothing but a word. It is better to modify padmasana or try a different meditation posture such as Sukhasana or Vajrasana. When you’re constantly feeling uncomfortable (or not feeling as in numbness) the mind is wandering. Sitting in a more comfortable position for meditation enables you to more easily still the monkey mind and surrender.
Best of luck to you.