There were different kinds of kings though - before a certain point in the history of most countries kings had to actively fight and wage war to achieve and maintain their positions. Over time this became more of a position where the king would deserve their positions simply by having ancestors who were "stupendous badasses" but otherwise actually had to do very little.
> otherwise actually had to do very little
The risk of being overthrown was always there. They had to maintain their power through some combination of force, propaganda, and actual good rulership.
Early medieval kings - like those of the Franks, the Visigoths or the Nordic people - were more often than not elected for life.
Arguably the distinction between royalty, nobility and commonfolk grew larger the longer the feudal system was in place, to the point where kings inherited entire countries by birthright at the end of the XVIII century.