Wild Bill is most likely correct regarding hot spots. With a gas heater, the rattle is a sure sign there is too much sediment in the bottom of a WH and needs either a through flushing or replacement. The rattle is caused by boiling without circulation of the water.
In an electric WH, it is the sound of a hot spot on the element and it should be replaced. Cleaning is usually not an option, how would you clean it, scrapping or rubbing it off with an abrasive can damage the surface and cause another even worse hot spot.
$15 for an element is a cheap try for fixing the noise.
The small bubbles in water are suspended and will normally join together or dissipate to the surface in one heating cycle. If you had that happening every time you used hot water and the tank refilled, there is some abnormality in the plumbing, shore or internally.