Once your knee gets rid of it's pain, then anytime you feel it starting to strain again.... shift to a lower gear.
Yesterday I saw one person struggling up a hill with a cadence less than 10 rpm. They were in the big chain ring and not in the biggest rear cog. Two people were walking their bikes up hills and those too were not in the biggest rear. Couldn't see the front.
I'm pretty sure they'll have knee pain if they don't give up cycling first.