I hardly know the 1st think about diesel engines, but, in a gasoline engine, "knocking" is often a sign of pre-ignition (the fuel/air mixture igniting in the cylinder before it's supposed to), caused by either too low a fuel octane rating, too lean a fuel/air mixture, or a spark timing problem. (The spark timing problem wouldn't be applicable to a diesel, of course, as its mixture is ignited by pressure, not electrically.)
Jim
Jim