The Messenger of Allah (ﷺ) had himself cupped when he was fasting and wearing ihram (pilgrim garb).

Sunan Abi Dawud Book 14, Hadith 61