Klebsiella pneumoniae (Kp) is of growing public health concern due to the emergence of multidrug-resistant and virulent strains. Taxonomically, Kp includes seven phylogroups, with Kp1 (K. pneumoniae sensu stricto) being medically prominent. Kp can be present in environmental sources such as soils and vegetation, which could act as reservoirs of animal and human infections. However, the current lack of screening methods to detect Kp in complex matrices limits research on Kp ecology. We designed a novel SYBR green real-time PCR assay, named the ZKIR assay, that targets Klebsiella pneumoniae and closely related species (phylogroups Kp1 to Kp7). Based on 48 Kp representing its phylogenetic breadth, and on 88 non-Kp strains, the ZKIR assay detected all Kp and was totally specific for Kp, as no false positive was found.We also tested this method on spiked soil microcosms after a 24 h enrichment step (in Lysogeny Broth supplemented with ampicillin 10 mg\/l) and a short sample treatment. We showed that this procedure was sensitive enough to detect one single bacterium in 5 g of soil.