In the Bhagavad Gita, Karma Yoga is described as the mental discipline or attitude that governs the actions of an individual. This means a person practising Karma Yoga does acts that are ordained for him whatever be his state (Ashrama) or status with the firm faith that he does them purely because these are ordained for him; he does not claim credit for doing these acts, nor does he desire any fruit or gain from the performance of these acts.
Lord Krishna speaks highly of Janaka and other Raja Rishis who are realised souls but are also engaged in their duties as rulers. It is very likely that the common man is inspired to emulate their commitment to duty — discharging one's duties for duty's sake.
Krishna also refers to Himself as an example of a Karma Yogi since it is He who has created the entire universe, and then sustains and takes care of all aspects of it untiringly. His omniscience, omnipresence and omnipotence embody Karma Yoga.
Interestingly, Hanuman also qualifies to be an ideal Karma Yogi, pointed out Srimati Jaya Srinivasan in a lecture. When he returned to Kishkinda after accomplishing the mission of passing on the tidings of Lord Rama to Sita, he only highlighted the plight of Sita and the severe penance she had undertaken ever since she was brought to Lanka by Ravana.
He never boasted of his other admirable deeds in Lanka — burning of Lanka, having an audience with Ravana, etc.
In fact, he felt ashamed to tell the other monkeys about his exploits in Lanka. He had rendered the greatest of service to the divine couple, yet he remained humble.
He felt in his inner being that all his greatness was due to divine grace alone. Even earlier, when he undertook the mission he sought the blessings and guidance of the divine couple.
The total lack of the sense of I and Mine in Hanuman's nature is the very basis of the spirit in which a Karma Yogi acts.
Hanuman did not wish to go to Vaikunta with Rama; instead, he opted to stay in the world and be in the midst of the devotees of Rama. Hanuman embodies the essence of bhakti and humility.