This guide might not be entirely up to date, but should give a decent overview of how kingdom leveling works:
The short of it though, the higher rarity of a troop, the higher level it can be leveled to. Common 15, Rare 16, Ultra-Rare 17, Epic 18, Legendary 19, and Mythic 20. (so a Common Peasant can only get to level 15, but a Mythic one can get to 20, also the level does not reset you when ascend) And each level counts for some kingdom power.