Lord Shiva was involved in long battle with Krishna. Why didn't Krishna know that Shiva was the God of the DevaLoka ?
king of devaloka is indra lord shiva is the ultimate god and the same ultimate god is lord narayana or krishna. But it is allright lord shiva is god of everyplace.
Lord krishna knows that the lord shiva is the ultimate god but the same is he. In harivamsa parva of mahabharat there are some reaons which led to this battel.
In real the first time the fight between shiva and krishna occoured in harivamsa parva of mahabharat first text dedicated to krishna even before srimad bhagwatam.
It says following:-
★Lord shiva helped bana to fight against krishna because bana done peance to rudra and got boon to become uma or godness parvati's son. And banasur got his thousand arms from starting and not by boon of lord shiva.
★Lord shiva gave boon to banasur when he was eager to fight with someone that when his flagstaff will be broken an unequal fight will be there.
★Godness parvati gave boon to usha that at a particular constelation or time the man which will come in her dream will become her husband. So,if banasur was wined then anirudha(who came in usha's dream) shall be killed or the usha and anirudh wouldn't get married.
★Lord shiva was not made fall asleap by krishna he only started to yawn and after been encouraged by banasur he was again gooing to fight but bramha realized him that his soul was divided into two parts (of which one is krishna) and the fight was over lord shiva and lord krishna greeted each other and lord shiva went away and there was a hymn to hari-hara.
you can check it from the harivamsa parva if needed.
harivamsha in the mahAbharata - viShNuparva Chapter 116 - story of bANAsura
harivamsha in the mahAbharata - viShNuparva Chapter 117 - pArvatI blesses uShA with a boon
harivamsha in the mahAbharata - viShNuparva Chapter 125 - fighting stops between rudra and KR^iShNa and hymn to harihara
If you want a detailed with verses then go to the website. http://shivaandvishnu.blogspot.in/2017/09/fight-between-krishna-and-shiva-from.html?m=1
Okay first of all lord narayan is not reincration of lord krishna but lord krishna is the incration of lord narayana. well in my answer i have written points that why battel took place then also i didn't explained it briefly now, lord krishna was fighting against bana because he has captured anirudha so,to free him lord krishna need to fight bana. Lord shiva fight with lord krishna to protect bana as he has given him boon to become his son.
Your next question that Did Krishna's dwarka exists at the same time as the Puranas (Shiva's Purana ) so, the answer is that the dwarka with lord krishna was not even present at the time when mahabharata was written or any other purana i don't think that at the the time of puranic age or even when Mahabharata was written dwarka existed with at least lord krishna because they are smriti text.
Because mahabharata mentions the death of material body of krishna by a hunter i.e. no body can kill god as he was in a human body which he leaved after arrow striked him.
originally purans are considred smriti(what has been remembred) no nessasory that at what time they were written things existed or taken place.