Alkali metals have a general outermost electronic configuration of

Alkali earth metals have a general outermost electronic configuration of

The +1 ion of the alkali metals has a stable octet configuration of the nearest noble gas as the outermost ns electron is lost.
The +2 ion of the alkaline earth metals has a stable configuration of the nearest noble gas as the two electrons in the outermost ns shell are lost.