The knee is a hinge. It bends and straightens and has a little rotation available when bent, and that is close to the whole of its repertoire. I spend more time on knees than on any other joint.
Which is why it is so often the place that hurts and so rarely the place that is at fault.
Above and below
The hip rotates. The ankle moves in several directions. The knee is stuck between them and does what they leave it to do.
If your hips do not rotate much, something has to give when a position asks for rotation, and the knee is the joint in the middle with the least say. The pain is real and it is at the knee. The cause is usually not.
Same downwards: stiff ankles change where your weight falls, and the knee absorbs the difference.
The positions worth respecting
Anything cross-legged, especially with a hand pulling a foot into place. That is rotation applied to a bent knee by force, and the knee is the joint least able to refuse it.
Deep kneeling positions, if there is any twist in them.
Any lunge where the back foot is fixed and the hips turn.
None of these are forbidden. They are the ones to arrive at slowly and to prop generously.
The single most useful rule
Knees do not negotiate. Muscular stretch is a sensation you can breathe into and work with. A knee giving you sharp, pinching or unfamiliar feedback is not offering a conversation.
Come out. Not later, then. And tell me, because I would rather change the pose than have you quietly avoid it for a month.
What actually helps
Hip rotation work and ankle mobility, which is to say working on the joints that are not hurting. That is counter-intuitive enough that people skip it for years.
Strength through range, too. Knees like being loaded in positions they can control, and the fear of loading them at all is its own problem.
When it is medical
Swelling, locking, giving way, or pain that has a history and a name. That is a conversation with a clinician and my class is not a substitute for it. Tell me what you have been told and I will work around it.