There were two main reasons why the Central Powers agreed to an armistice. These two reasons were the main factors behind their defeat.
First, the Central Powers were in economic trouble. That is, they (more specifically, Germany, which was the most important of them) could not afford to keep fighting. The Germans had been squeezed by the British naval blockade, which deprived them of resources. They were running out of men to put in the army. They simply could not keep fighting for long. Therefore, they launched a major offensive in the spring of 1918. When this failed, they were doomed.
Second, the Americans entered the war. Where the Germans had no large numbers of new men to put into the war, the Allies now had millions of Americans. The Americans helped to smash the Germans, who were weakened by the failed spring offensives. Even worse, it was clear that there were many more Americans available to throw into the fight. This meant that Germany was doomed.
For these reasons, the Germans and their allies realized the war was lost and they surrendered.