Ionic bonds are bonds between two who has a large difference in . For instance Sodium chloride:
Sodium have a low electronegativity and chloride have a very high electronegativity.
Covalent bonds are bonds between elements both with high electronegativity. For instance CO2. Oxygen have a high electronegativity and carbon have a electronegativity in approx the middle of the scale.
As a rule of thumb you can think of it as, the non metal elements forming molecules, for instance
All metals (for the most) with a non metal forms an ionic bond: