Resin in softwood knots can stay active for years, and bleed slowly through most paints, even if the wood has been kiln dried. The only way to really stop the bleeding is to use a shellac to seal in the resins.
Shellac is not a very strong finish but has the unique characteristic that it allows nothing through it. A clear shellac will work well. If you need to cover over colour differences, use a white shellac-based primer.
Shellac is a natural product, not a chemical creation, so it only has a one year shelf life. Don't try to use old shellac, it may not block the stain. You could just spot shellac over the knots, then prime the entire wood with a paint primer, or you could use the shellac as the primer over the entire surface.