Robert Kay, 36, from Bonnyrigg, stabbed Carlo Volante, 40, in a "one sided violent attack" in broad daylight in front of his girlfriend, Mhairi Hughes.
At the High Court in Glasgow, Kay pleaded guilty to murdering Mr Volante in Bonnyrigg, on 3 January 2017.
Judge Lady Rae will sentence Kay at a later date.
The court heard Kay rented a room to Miss Hughes who was in a relationship with Mr Volante, who lived with her.
Advocate depute Angela Gray said at about 14:00 on 3 January, Mr Volante and Miss Hughes decided to go to her mum's house to walk the dog.
She said: "In doing so they also woke up the accused who shouted.
"Miss Hughes shouted at Kay and Mr Volante told Kay not to shout at Miss Hughes.
"Miss Hughes felt she had enough and was not going to put up with Kay any longer so she and Mr Volante decided they were moving out right away."
They started packing belongings and shouted at one another to hurry and Mr Volante realised he should have been at work that day.
He shouted at Kay because he was annoyed at missing work then went downstairs to take bags outside for his girlfriend.
Seconds later Miss Hughes heard a disturbance and looked out to see Kay running down the path, away from the door.
She heard Mr Volante shouting "He has a knife" and other witnesses saw Kay chase after him.
Mr Volante ended up on the ground and Kay stood over him and stabbed him "a number of times on the upper body".
Miss Gray added: "Miss Hughes at this time was only five metres away, not going any closer out of fear and was shouting and screaming at Kay to leave Mr Volante alone.
Mr Volante was taken to Edinburgh Royal Infirmary but pronounced dead at 5.52pm.
He was found to have 14 sharp blade injuries with nine of them being stab type injuries.
Defence QC Donald Findlay said Kay has no recollection of the incident and the last memory beforehand is an alleged threat made by Mr Volante.
A man has admitted murdering his flatmate's boyfriend after a row when he was accidentally woken up by the couple in Midlothian.