Spending a lot of time on the stationary trainer bike this winter, and I'm learning one key to tolerating discomfort is negotiation.
"Just 30 more seconds..." then
"OK now you're halfway done this interval, good job, keep going" then
"You're over half done the intervals! You can't stop now!" etc
Just like when you're out on the road and you keep fighting to hold your target power/pace until the next corner, or telephone pole, or sign, or whatever.
Breaking it down into smaller chunks to trick your brain seems to be key