This is definitely the novel The City and the Stars by Arthur C. Clarke, first published in 1956, and the character playing the role of the "Jester" is called Khedron.
According to his biography:
A man with the rare role of "Jester." He has unparalleled access to the inner workings of Diaspar, which on occasion he uses to create elaborate pranks. His role was designed by the city's founders to prevent stagnation in society. Alvin feels an affinity to him, while at the same time finding him annoying and cryptic. Despite the Jester's birthright, he ends up proving himself a coward incapable of facing the very dramatic changes brought by Alvin.
Regarding the other details of the story, according to the wikipedia synopsis, the city is called Diaspar and is completely enclosed:
The City and the Stars takes place one billion years in the future, in the city of Diaspar. By this time, the Earth is so old that the oceans have gone and humanity has all but left. As far as the people of Diaspar know, theirs is the only city left on the planet. The city of Diaspar is completely enclosed. Nobody has come in or left the city for as long as anybody can remember, and everybody in Diaspar has an instinctive insular conservatism.