The knives are out.

Britney Spears and Kevin Federline are in an all-out war after the father of her two kids has unearthed sharp claims in his memoir, “You Thought You Knew” (out Tuesday) — alleging his ex-wife was physically and verbally violent with their sons and even used cocaine while breast-feeding .

Federline, 47, writes that he walked into a dressing room at his album-release party in 2006 to find “Britney and [a] young starlet friend snorting a fat line of coke off the table …They didn’t even try to hide it.”

At the time, their son Sean Preston (who goes by his middle name) was 1 year old and Jayden James was 1 month old.

“Please don’t go home and breastfeed the kids like this. Call your mom or someone. We need to get formula. You can’t do this,” Federline recalls sayin

See Full Page