South Africa captain Steven Pienaar has retired from international football just three months before his country hosts the 2013 Africa Cup of Nations.