Software Defined Networking (SDN) change the routing architecture from distribution to centralization. Then the centralized controller placement becomes an important issue since network delay and synchronization will be affected. In this paper, the problem of controller placement to optimize the network average reliability is studied. We first consider the optimization problem for controller placement under the assumption with the shortest path between controller and switches, and a clustering based optimal controller placement algorithm and sub-optimal algorithm base on greedy algorithm are proposed, respectively. Then, we extend the controller placement problem to more general case with multi-paths between controller and switches. In this case, to reduce the computation complexity, a Reliability Factor is defined to replace the network average reliability. After that, modified clustering based and greedy based algorithms are proposed to make the optimal and sub-optimal solution, respectively. Finally, simulation results demonstrate the performance of the proposed algorithms better than regular placement stratagem with the Internet2 OS3E and the Internet Topology Zoo.