Combine salt, pepper, garlic, cloves, bay leaves, star anise, and allspice berries in a small bowl. Coat duck legs with spice mixture on all sides. Place on a rimmed baking sheet and transfer to refrigerator, uncovered. Let sit at least 24 hours and up to 3 days.
Scrape aromatics off of duck legs and reserve. Place legs in an even layer, skin side down, in Instant Pot. Place on saute setting. Cook until golden, about 10 minutes. Flip legs, add aromatics to pot, and top with lid. Place on high pressure and cook 40 minutes. Release pressure manually. Carefully remove legs from instant pot. You can either crisp the skin in a skillet over medium-low heat and eat immediately, or transfer legs to a heat-proof container or bowl. Cover with rendered fat from cooking. Let cool and refrigerate until ready to use. For best results, scrape excess fat off of chilled duck legs and sear in a cold skillet over medium heat until skin is golden and crispy, flipping once.