A king was a male monarch, the ruler of a kingdom. The female version of this title was queen. The title could also be used figuratively, to indicate that one dominated, or "ruled", a particular field.
In the song "I Am the Very Model of a Modern Major-General", the titular major general boasted of knowing the kings of England. (ST: "Q&A")
In an ancient story from Earth, Gilgamesh was king of Uruk. (TNG: "Darmok")
Leonidas was a Spartan king who led his people in the Battle of Thermopylae. (DS9: "What You Leave Behind")
King Lear was a character in the eponymous play. (Star Trek II: The Wrath of Khan)
King Arthur was a mythical English king. (DS9: "The Muse")
Hrothgar was a king in the poem Beowulf, set in 6th century Denmark. (VOY: "Heroes and Demons")
Hamlet was a 7th century Danish king, whose murder was avenged by his son. (TOS: "The Conscience of the King")
Macbeth was an 11th century Scottish king. He gained the throne by murdering King Duncan. (TOS: "The Conscience of the King")
Brian Boru was the High King of Ireland in the 11th century. The King of Leinster was also a king in Ireland. (DS9: "Bar Association")
Richard was a 12th century English king. (TOS: "Space Seed")
Robert the Bruce was a 13th and 14th century Scottish king. (TOS: "The Savage Curtain")
Henry V was a 15th century English king, a campaigner in France. (TNG: "The Defector")
Henry VIII was a 16th century king in England. (TNG: "In Theory")
Louis XIV was a 17th and 18th century king in France. (TOS: "The Savage Curtain")
According to Michael Sullivan, the King of the Faeries ruled Castle O'Dell at night. (VOY: "Fair Haven")
The King was a fictional character in the Earth fairy tale Rumpelstiltskin. (DS9: "If Wishes Were Horses")
According to Spock, Kevin Riley believed himself to be the descendant of Irish kings. (TOS: "The Naked Time")
Quark was known as "the synthehol king" on Ferenginar. (DS9: "Body Parts") Later, after exposing the Balancar Agricultural Consortium stockpiling squill, Quark called himself "the king of squill". (DS9: "The Magnificent Ferengi")
In 2374, Jack, Lauren, and Patrick compared Gul Dukat to a king who had lost his throne. (DS9: "Statistical Probabilities")
By 2380, Phibeas was the king of the people of the planet Khwopa. (LD: "Much Ado About Boimler")
In 2401, king was listed as one of the results in Raffaela Musiker's search for the "red lady". (PIC: "The Next Generation")
In 1996, Abdullah bin al-Hussein, then a Prince of the Hashemite Kingdom of Jordan, appeared as an extra in the Star Trek: Voyager episode "Investigations". He was crowned king of Jordan in 1999. Kinghood was also discussed in the song "Heroes", which was used as incidental music in ST: "Children of Mars".