Potassium atom has just one valence electron and Chlorine has 7 electrons, Cl atom needs just one more electron to complete its octet, which it receives from K atom. So an ionic bond forms between potassium and chlorine and Potassium Chloride gets formed.