The spokesman, Rear Adm. John Kirby, said that the assailant, dressed in an Afghan army uniform, fired into a group of international soldiers at the Marshal Fahim National Defense University at Camp Qargha, a base west of Kabul, and was subsequently killed.
Another 15 people, roughly half of them Americans, were wounded. Among the wounded were a German brigadier general, two Afghan generals and an Afghan officer, whose rank the Afghan Defense Ministry did not provide.
The attack occurred during a site visit to the university by coalition members.
Ministry spokesman Gen. Mohammad Zahir Azimi, said a "terrorist in an army uniform" opened fire on both local and international troops.
The Qargha shooting comes as so-called "insider attacks" — incidents in which Afghan security turn on their NATO partners — largely dropped last year. In 2013, there were 16 deaths in 10 separate attacks. In 2012, such attacks killed 53 coalition troops in 38 separate attacks.