Many modern people have romantic imaginations about knights: the eight virtues of knights, defending the country and slaying dragons, protecting the people and guarding the village... However, in reality, in the medieval era on Earth, these beautiful expectations for knights remained only in books.
In the end, knights were vassals of lords and were an alternative type of mercenary, with the saying "I give you money and land" in exchange for their loyalty and bravery, as well as that of their family members and servants.
Low-rank nobles like knights and barons were originally lower-level nobles granted lands by their lords. The majority of them never thought about fighting for commoners... On the contrary, when wars broke out, commoners, armed with dung forks, became cannon fodder at the front lines.
Knights always remained loyal to their lords, and the lords were loyal to higher-ranking lords or directly to the king. This hierarchy was known as the "feudal system."