When the Messenger of Allah ﷺ intended to observe itikaf, he would pray Fajr and then enter his place of seclusion.
حدثنا هناد حدثنا أبو معاوية عن يحيى بن سعيد عن عمرة
كان رسول الله ﷺ إذا أراد أن يعتكف صلى الفجر ثم دخل في معتكفه
Agreed upon. Muslim recorded it in itikaf, chapter "When should one who intends to observe itikaf enter his place of retreat," hadith 1173, from the narration of Abu Muawiya. Bukhari recorded it in itikaf, chapter "The itikaf of women," hadith 2033, from the narration of Yahya bin Saeed Ansari, with the same wording.