Calcium, aluminium, potassium and beryllium are electropositive elements. They generally lose their outermost shell's electrons to attain a complete octet and hence stability.
On the contrary, chlorine is an electronegative element. It gains one electron to complete its octet and attain stability.
Hence electropositive and electronegative elements come together, bond with each other to attain individual stability. This kind of bond, that is formed by transfer of electrons, is called ionic bond.
Chlorine has 7 electrons in its outermost shell. It needs one more electron to complete its octet.
Calcium atom has 2 electrons in its outermost shell. It needs to lose those 2 electrons in order to attain stability. However a Cl atom can accept only 1 electron. Hence 2 Cl atoms are required.
Aluminium atom has 3 electrons in its outermost shell. It needs to lose 3 electrons. It can give only 1 electron to a Cl atom. Hence 3 Cl atoms are needed to bond with Al.
Similarly, potassium atom has 1 outermost electron. A single Cl atom is sufficient for bond formation with K.
Beryllium atom has 2 outermost electrons, just like Ca. Hence 2 Cl atoms are needed.