In nature, plants recruit a diverse microbial community, the plant microbiome, that is distinct from the surrounding soil community. To understand the forces that shape the plant microbiome we need to characterize the microbial traits that contribute to plant colonization. We used barcoded mutant libraries to identify bacterial genes that contribute to the colonization of a monocot and a eudicot host. We show that plant colonization is influenced by dozens of genes. While some of these colonization genes were shared between the two host plant species, most were highly specific, benefiting the colonization of a single host and organ. We characterized an efflux pump that specifically contributes to Arabidopsis shoot colonization. This efflux pump is prevalent across Pseudomonadota genomes, yet benefits the bacterial association with only a small subset of Arabidopsis thaliana accessions. Leveraging genomic diversity within Arabidopsis thaliana, we confirmed that specific glucosinolate breakdown products are detoxified by this family of efflux pumps. The broad prevalence of this efflux pump family suggests that its members contribute to protection of commensal bacteria from collateral damage of plant glucosinolate-based defense responses to herbivores and necrotrophic pathogens.