Does anyone know what determines the stockpiles of a castle/fort?

Is it the level of farms the province has?
How do you increse stockpiles.

I want to make the horde attack a heavily fortified citadel in khazar, but it says

if attacked it will hold out for 2 years


How do i increase that, can you increase that?