Depends on the albergue and the hospitalero.
If it´s a private organization or a business, you negotiate your own terms.
If it´s a municipal or church-run albergue that´s part of the Federation of Amigos of the Camino, you take a training course that fills you in on expectations, first aid, bookkeeping, etc., and provides you with a modicum of insurance coverage whilst serving in an associated refuge. The courses are offered periodically through Spain and via national pilgrimage groups in several other countries.
Or you can just offer to stay around and help out for a day or two or three, when you see there´s a need and the management seems willing. Great friendships have been born that way!
good luck!
Reb.