Pep Guardiola will take over as Bayern Munich boss at the end of the season, the Bundesliga club have confirmed.