Eight Afghan soldiers were killed on Tuesday while repelling a fierce Taliban attack on Kunduz, a strategic city in northern Afghanistan that had briefly fallen to the militants twice in the past, officials said.