Who were king of Judah when David was king of Israel?

King David was the king of Judah and Israel.

The separation between the kingdoms was on the days of king David's grandson, king Rehoboam (son of king Solomon, who was the son of king David).