A method implemented for network function placement is disclosed. The method optimizes network function placement for each traffic flow, to minimize the overall inter-pod traffic volume. For each traffic flow going through a data center, the method initiates a pod list. The network functions of the traffic flow is sorted in a descending order by resource demanded. Then one network function is selected one at a time according to the descending order. For each network function, the pods in the pod list is sorted in an ascending order by resource available in each pod. The method selects a first pod for the network function when possible. When no pod in the pod list has enough resource for the network function, the method adds a pod with the most available resource from a pod pool to the pod list, and selects the added pod for the network function.