Joab the son of Zeruiah was the commander in chief of the army. Jehoshaphat the son of Ahilud kept the government records.
(SEE 4:1)
David had told his troops, "The first soldier to kill a Jebusite will become my army commander." And since Joab son of Zeruiah attacked first, he became commander.
David ruled all Israel with fairness and justice.
Zadok the son of Ahitub and Ahimelech the son of Abiathar were the priests. Shavsha was the secretary.
Jehoiada the son of Benaiah was the king's advisor after Ahithophel, and later, Abiathar was his advisor. Joab was commander of Israel's army.