First of all Germany did not 'agree' to an armistice, they asked for it. But there was several reasons they asked for it. All their allies had surrendered. The central powers were exhausted and could no longer continue to prosecute war. The German front line had been broken and Germany had no chance of blocking the advance of allied forces. The Germans knew the allies could repeat the success of these offences anytime and anyplace they chose. The war had been lost and Germany was sensible enough to quit and accept that.