An investigation is made of the equation for the self-consistent plasma potential in the case of a weakly inhomogeneous quantum plasma in the one-dimensional external potential of planar defects in metals. The condition for localization of plasmons at planar defects is obtained.