An Israeli soldier was shot and killed by police after opening fire in Netanya, prompting an investigation.