The German government has expelled a Russian diplomat over a case involving espionage related to the war in Ukraine.