The greatest similarity between samurai and knights is that they both lived in societies that were built on feudalism. Samurai and knights were required to pledge fealty to their lord and were required to serve them in times of war.
Knights and samurai were respected warrior classes in Europe and Japan. They were both hereditary classes, which meant that children who were born to families in these classes would follow in their footsteps and become samurai or knights. There was very little social mobility in both societies, and it was very rare for common peasants and farmers to become a knight or samurai.
Samurai and knights followed strict ethical codes that dictated how they should act in times of war and peace. Samurai followed the teachings of bushido, or "the War of the Warrior," while knights were bound by the chivalric code. Both of these codes required samurai and knights to act honorably in battle and to swear loyalty to their lords.
Feudal Japan and Europe were both periods of constant warfare that made warriors such as samurai and knights invaluable. Both classes served local lords who gave them titles and land in exchange for military service during times of war.