US officials said the eight Isaf troops and one foreign contractor were all American, AP news agency said.
Witnesses reported hearing sirens and seeing a heavy military presence near the facility, which generally has tight security.
A senior Afghan security official told the BBC the pilot’s name was Gul Ahmad, and he came from the Tarakhel area of Kabul.
He was suffering from “mental illness”, and either got into a fight with his foreign colleagues or planned the attack after being recruited by the Taliban, the official said.
A spokesman for the Afghan Air Corps, Col Bahader, told AP the shooting was in an operations room of the Afghan Air Corps.
“Suddenly, in the middle of the meeting, shooting started,” Col Bahader said. “After the shooting started, we saw a number of Afghan army officers and soldiers running out of the building. Some were even throwing themselves out of the windows to get away.”
The Taliban claimed responsibility for the incident in a text sent to AP but the authorities have not confirmed any insurgent activity.
President Hamid Karzai and senior Isaf commanders condemned the shooting.
The head of the Nato training mission in Afghanistan, Lieutenant General William Caldwell said the programme had “suffered a tragic loss from an attack, which occurred this morning, resulting in the deaths of nine coalition trainers”.
Correspondents say rapid recruitment into the Afghan military has raised fears of Taliban infiltration into the police and army.