Symbolism, Imagery, Allegory
In Proverbs, the King is basically a mini-version of God. The sort of loyalty and faith that you are supposed to place absolutely in God should be given to the king, but with a few more preconditions. Proverbs recognizes that there's such a thing as really bad kings, though it tends to speak more about the ideal.
There are also some chief differences between the King and God—aside from the basic idea that kings are mortals created by God like everyone else. Proverbs records:
It is the glory of God to conceal things, but the glory of kings is to search things out. Like the heavens for height, like the earth for depth, so the mind of kings is unsearchable. (Proverbs 25:2-3)
Kings' mirror God in the "unsearchable" quality of their minds, but they play a different role. God is like the person setting up a game, and the king is the person actually playing it—God has concealed things that the king must then reveal, meeting all God's tests and managing to judge righteously and solve problems.
It's a little like God's the Dungeon Master in D&D and kings and other humans are the Player Characters (if you have absolutely any idea what we're talking about). This isn't only an example of how kings should behave, but in a broader way, of how all human beings should act within the parameters God has set for them.