The interplay between the Kondo effect and magnetic ordering driven by the Ruderman-Kittel-Kasuya-Yosida interaction is studied within the two-dimensional Hubbard-Kondo lattice model. In addition to the antiferromagnetic exchange interaction, $J_perp$, between the localized and the conduction electrons, this model also contains the local repulsion, $U$, between the conduction electrons. We use variational cluster approximation to investigate the competition between the antiferromagnetic phase, the Kondo singlet phase, and a ferrimagnetic phase on square lattice. At half-filling, the Neel antiferromagnetic phase dominates from small to moderate $J_perp$ and $UJ_perp$, and the Kondo singlet elsewhere. Sufficiently away from half-filling, the antiferromagnetic phase first gives way to a ferrimagnetic phase (in which the localized spins order ferromagnetically, and the conduction electrons do likewise, but the two mutually align antiferromagnetically), and then to the Kondo singlet phase.