It is time-consuming for acquiring complete data by fully phase encoding in two orthogonal directions along with one frequency encoding direction. Undersampling in the 3D k-space is promising in accelerating such 3D MRI process. Though 3D undersampling can be conducted according to predefined probability density, the density based method is not optimal. Because of the large amount of 3D data and computational cost, it is challenging to perform data-driven and learning-based 3D undersampling and subsequent 3D reconstruction. To tackle this challenge, this paper proposes a deep neural network called EEUR-Net, realized by optimizing specific undersampling patterns for the fully-sampled 3D k-space data. Innovatively, our undersampling algorithm employs an end-to-end deep learning approach to optimize phase encoding patterns and uses a 3D U-Net for image reconstruction of undersampled data. Through end-to-end training, we obtain an optimized 3D undersampling pattern, which significantly enhances the quality of the reconstructed image under the same acceleration factor. A series of experiments on a knee MRI dataset demonstrated that, in comparison to standard random uniform, radial, Poisson and equispaced Cartesian undersampling schemes, our end-to-end learned undersampling pattern considerably improves the reconstruction quality of undersampled MRI images.