Used to show that what has just been referred to is not ideal and that the speaker or writer believes it cannot be helped or improved upon, or is unwilling to do so.
But hey is typically followed by a justification, explanation or excuse for the circumstances referred to. It is also used with nothing following it, in which case it stands for "but nothing can be done about this and so it must be accepted".
English Wiktionary. Available under CC-BY-SA license.