Covalent bonds are in between two atoms and occurred by sharing two electrons in their outer shells or orbitals, thus completing the number of electrons in both their orbitals and achieve an electron configuration similar to inert gas. Covalent bonds are are much likely to happen between two atoms whose electronegativities are equal or close to equal.
Ionic bonds are occured when one atom gives an electron or more to a more electronegative atom. This makes one atom positively charged and leaves other negatively charged. They both make their outer electron shells complete, one by adding the required number of electrons and other by removing the outer shell. The attraction between the two positive and negative is the mechanism of ionic bonds. Unlike covalent bonds, ionic bonds are usually occured in between metals and non metals whose electronegativities are much more different. Example: LiBr. Here Br is more electronegative and it can take an electron from Li to produce Li+ and Br- ions. The attraction between those two ions result in an ionic bond.