I had a water heater that did this. I replaced it as it was old and wasn't efficient. The old heater made rumbling and "Pinging" noises and was caused by minerals in the water building up on the liner, flaking off and collecting in the bottom.
I have heard that if you remove your heater, take it out into your yard, hook it up to the hose, lay it on it's side, and then roll it back and forth as water runs through it, that will remove most of the loose stuff. I didn't try it bacause as I mentioned, mine was old and inefficient.