This talk concerns joint work with Wilfrid Gangbo on the solution of the spatially inhomogenous kinetic Fokker--Planck equation, a close relative of the Boltzmann equation. This is done by solving a sequence of constrained variational problems in a Wasserstein metric. The constraints provide the conservation of mass, energy and momentum while the entropy functional being optimized provides the entropy production. Building on ideas recently introduced by Felix Otto in his work on the porus medium equation, we shall show how such an approach provides new control over kinetic equations, such as the one we consider.