Doable, but not universally, and not alone.
If the country is ruled by a well-loved king, forget it. He won't rule by threat of his weapons alone.
But if there's a strong dissenting faction - an oppressed ethnic minority, , the soldier's expertize in tactics, modern warfare and modern ideas of politics could earn him the place of the leader of a revolution, and then, leading the revolt, he can take over the kingdom.
The weaponry could be a boon - a sniper gun would make a short story of enemy leaders and the hated ruler. Arming the rebels with makeshift explosives and teaching them modern, stealthy combat techniques would enable them to overcome superior forces of the enemy army. And in the end, becoming the hero, he would have no problems being accepted as the ruler.
Of course he couldn't just be a common grunt who choose army because he was too stupid to do anything better. He'd need to be a smart person with a good empathy sense, to acquire the right allies - simultaneously friends and advisors; ones who would enable him to rule efficiently by serving the right advice and not backstab him to seize the power themselves. And yes, he would still be at risk of assassination, poisoning or just armed assault by an overwhelming enemy force (even if his army was mighty and skilled, sheer numbers of the enemy could shift the balance.) But these are standard risks of a wise king.
His worst problem would be approval of his peers. He has no "noble parentage", so winning acceptance by the elites and neighbor kings would require exquisite wit. Possibly clever political maneuvers involving religious powers could help - if he wipes heretics from an occupied catholic country, he could seek the blessing of the Pope, receiving the crown by God's will. That certainly would help his stance. Consigning a large unit of his elite troops skilled in modern battle techniques, medicine and logistics, armed with explosives and firearms, to a crusade, and actually making the crusade successful, would earn him enough of unquestioned fame that his position would be secure for a long time.