Why did Ned never try and legitimatize Jon?

I mean Ned clearly really loved Jon so why never try and legitimatize him rather then let him be constantly shamed and insulted being a bastard would it not make sense to free him from those constraints? now only a king can legitimize a bastard but Ned is friends with Robert so im sure he could have convinced him