I have a question... why did Ned confess to being a traitor?
The reason Ned confessed is because Varys convinced him to do so.
While Ned stated that honor means more to him than his own life, Varys pointed out that Cersei still held Sansa. There was also a deal to let Ned take the Black for his alleged treason, however Joffrey nixed that deal.