Knuckles is both and neither, really. At the start of Sonic and the Black Knight, he does try to kill Sonic, but he later teams up with Sonic and the others to defeat the villainous Merlina. So his allegiance shifts over the course of the story.