KP duty means "kitchen police" or "kitchen patrol" work under the kitchen staff assigned to junior U.S. enlisted military personnel. "KP" can be either the work or the personnel assigned to perform such work.  In the latter sense it can be used for either military or civilian personnel assigned or hired for duties in the military dining facility excluding cooking.

Duties include washing dishes, food preparation, and bussing tables.

The image of enlisted soldiers peeling potatoes (to remove the skin) in an installation's kitchen was once associated with the popular culture image of KP duty due to its frequent appearance in mid-twentieth century movies and comic strips about life in the US services.

Etymology
The U.S. military sometimes uses the word "police" as a verb to mean "to clean" or "to restore to order."  For example, after a company picnic on a U.S. Marine Corps base, a group of Marines might be assigned to police, or clean up, the picnic grounds.  Its origins in this usage probably came from the French sense of maintaining public order.  Kitchen police then may mean to restore the kitchen to order, or clean up the kitchen. The term "KP" has been used in the United States since as early as 1918.

History
In the U.S. military, it is often more formally known as mess duty, and is restricted to enlisted personnel. A service member is sometimes "put on KP" for some minor infraction committed while on duty, in uniform, or on a military installation, something that would not require an Article 15 or non-judicial punishment hearing.  In the British Forces the equivalent punishment is known as Jankers.  However, KP is usually assigned out of necessity, not for punishment.  In this latter case, all junior enlisted personnel assigned to a mess would be put on a roster and regularly receive assignments to KP duty on a rotating basis.

KP duties, however, can include any tedious chores in the military mess at an installation or in the field, such as food preparation, although not cooking, or the more obvious dish washing and pot scrubbing, sweeping and mopping floors, wiping tables,  serving food on the chow line, or anything else the kitchen staff sees fit to assign to its KP crew.  KP duty can be particularly onerous because it is on top of all regular duties, as institutional kitchens often open before and close after regular duty hours, and generate large volumes of unpleasant food wastes.  Mess halls for the modern U.S. military are often contracted out to civilian firms, making KP duty less common today than it once was.

United States Navy
In the U.S. Navy all sailors are assigned to 90 days of Temporary Assigned Duty (TAD) upon reporting to their respective commands. For most sailors this will mean being sent to a shore-based or shipboard galley, which includes, but is not limited to, washing dishes in the scullery, food prep, mess deck cleaning, and/or line server. The only exception is if the individual is in a "critical rating" and cannot be spared. Personnel assigned these duties are known as Food Service Attendants or FSAs (formerly called mess cooks). Upon completion of 90 days' TAD, a Page 13 entry is made into the individual's service record to prevent reassignment to the galley or mess deck.

References

Military life