We are extracting Nitrogen from the atmosphere, that isn’t going to run out. Ammonia is made from Nitrogen and Hydrogen, it’s the Hydrogen that’s extracted from natural gas. However, splitting it from water is again effectively unlimited and not that expensive.
Phosphorus is plentiful, current methods give us a 300+ year supply and other options exist. Potassium is a little more questionable we are likely to need to mine the ocean floors fairly soon which would spike prices, but it could ultimately be a closed loop where we are collecting the runoff.