It's very simple if you have both cadence and HR monitors. Find a gear you can spin 80 rpm+/- and keep your heart rate no more than 80% of max. You should be able to tackle most climbs and not bother your knees.
On steeper stuff my cadence will drop lower than 80 rpm-and it can certainly create some pain the knees if there are long hard climbs.