When we look at the periodic table, we see many single atoms there, with their atomic numbers and atomic masses, but this is not exactly how we are going to see them presented in nature. In nature we see a few elements that exist as diatomic molecules, for example, H2, N2, O2, F2, these molecules have covalent bonds with each other, and all of that is due to stability, every atom looks for stability, and one common way to reach that is by following the octet rule, and having 8 electrons in its valence shell. This is why we see atoms forming covalent and ionic bonds as well.