Jacques Kallis will retire as the third highest run scorer in Test cricket after making a century on his final appearance for South Africa.