It got so bad for Mike D’Antoni last season when he was coaching the Knicks that he “resigned” his position as head coach, essentially abandoning his goal of turning the team into a championship contender. The dream job had become a nightmare.

He’s trying not to wear that same look again in only his first season as the Lakers head coach, a season filled with stress and tension created from trying to manage a whirlwind of egos, expectations and injuries.

Certainly more nights like last night at Barclays Center will help. The Lakers collected their sixth win in seven games with a 92-83 triumph over the Nets, who folded over the last 2:32 minutes of the game after leading 83-82.

At 23-26, the Lakers record remains a disappointment, keeping the heat on D’Antoni to prevent his team from suffering a lost season. “We’re just trying to get wins and move forward and play the right way,” D’Antoni said in the bowels of the Barclays Center.

You would think having won six of seven would offer a chance to exhale. But the Lakers played last night’s game without Dwight Howard (shoulder) and Metta World Peace, who was serving a one game suspension for hitting Pistons guard Brandon Knight.

Howard’s absence figured to create more playing time for Pau Gasol, who has been frustrated by his lack of use in D’Antoni’s speed ball offense. Gasol complained to the Los Angeles Times that the Lakers’ talent was “not being maximized.” But after scoring 15 points last night, he injured his foot with 4:21 remaining in the fourth quarter and had to leave the game. He has a plantar fascia strain and will get an MRI tomorrow.

Judging from the way things have gone for D’Antoni in Los Angeles, coaching the Knicks for the previous 3 1/2 seasons was a breeze. Expectations were low as the club used the first two seasons to purge itself of long-term contracts in order to free cap space to make a run at LeBron James when he was a free agent.

They settled for Carmelo Anthony and Amar’e Stoudemire, and smartly acquired Tyson Chandler. But D’Antoni failed to find a workable chemistry after the talent arrived. There was the brief run of Linsanity, but that ended almost as quickly as it erupted, prompting D’Antoni to walk away from the job on March 14 amid a six-game losing streak.

He’s trying not to make the same mistake in Los Angeles. Hired by the Lakers on Nov. 12, D’Antoni has the security of a three-year deal worth $12 million to accept what looks to be an even bigger coaching challenge than he had with the Knicks.

Howard may or may not be coming back next season, while Kobe Bryant (age 34), and Steve Nash, who turns 39 tomorrow, have no time for a rebuilding job. That’s why D’Antoni’s calls for patience have been ignored.