Without having them apart it’s going to be difficult to be certain. Could be anything from a bit of grit in the bearing, or pitted bearing surfaces/bearings, or cracked bearing rattling around.
They’re easy enough to split open, the axle assembly just slides out once the locking collar is undone. clean it up, a good skoosh with gt85 would do it, look for any visual signs of corrosion/wear. if it doesn’t seem bad, half fill the pedal body with grease and refit the axle. Excess grease will push it’s way out of the pedal as you tighten the lock nut up.
If the knocking is still there, new assembly/bearings/pedal, depending on what you can be botehred sorting 🙂