The treasury is the amount of gold present in your entire empire. It is influenced by two factors:
The populations in the various provinces will pay taxes. The accumulated gold will be transferred to the treasury. Bad random events -- sometimes created by enemy spellcasters -- will cost you gold, while good random events will sometimes bring you gold.
Upkeep is the Gold required to keep a troop or commander in your employment. It is always the gold cost of the unit divided by 15. Holy units pay less upkeep (Gold cost divided by 30). Resources are not used for upkeep. A few Summonable Monsters like Trolls demand gold upkeep, but most summoned Monsters work for free.
The ruler who cannot pay his troops can expect random desertions among the disgruntled.
See also page 40 of the printed manual.