WASHINGTON — As President Trump strains alliances and relationships around the world, some of the nation’s top career diplomats are breaking publicly with him, in what amounts to a quiet revolt by a cadre of public servants known for their professional discretion.

On Monday, the chargé d’affaires at the American Embassy in Beijing, David H. Rank, announced his resignation after telling his staff he could not defend the Trump administration’s decision to withdraw from the Paris climate accord.

A day earlier, the acting ambassador to Britain, Lewis A. Lukens, tweeted his support of London’s mayor, Sadiq Khan, in the wake of a deadly terrorist attack there. On Sunday morning, President Trump had picked a fight with the mayor on Twitter.

Last month, the ambassador to Qatar, Dana Shell Smith, reacted to Mr. Trump’s dismissal of the F.B.I. director, James B. Comey, by tweeting, “Increasingly difficult to wake up overseas to news from home, knowing I will spend today explaining our democracy and institutions.”