As the Internet of Vehicles (IoV) develops, vehicular applications become more complex. The existing offloading methods in the vehicular networks predict the time it takes to process a task and offload it to the computation resources that minimize the delay in execution. However, these methods do not adequately consider other vehicles on the road or the time constraints of the applications. Therefore, we propose a dynamic task offloading method with a centralized controller to improve the task success rate considering all vehicles on the road. We formulate the objective function which maximizes the success rate as a multiple knapsack problem by using an approximation algorithm. In the proposed method, the centralized controller gathers the information on vehicles and edge servers, and based on the algorithm it determines the edge server that maximizes the task success rate in the entire area. The algorithm calculates vehicle priority depending on the task success status of vehicles and determines the edge server based on that priority. In this paper, we conducted the experiments in which we implemented the prototype of the proposed method, and evaluated its performance. The experiments showed that the offloading method improved the task success rate by up to 38% compared to the existing methods.