A tank that bangs is usually telling you about the bottom of the tank, but the timing of the noise separates two causes.
When does it happen?
A bang that starts a few minutes after the burner lights, and runs until it shuts off, is scale popping as trapped water turns to steam under it.
A single loud crack at the start or end of a cycle is thermal expansion in the piping or the tank itself, and it is a different problem.
A rumble that continues after the heat stops points at flow.
The scale explanation
Hard water deposits a mineral layer on the hottest surface. Under that layer, water overheats, flashes, and lifts the crust. The result is the pop or bang, repeated through the cycle.
With hardness near 9 grains here, the layer forms steadily, and a tank that has never been flushed will have one.
The expansion explanation
A closed system with no expansion tank lets pressure spike as the water heats. Pipes move, and the tank can creak or knock.
Check for a backflow device or a pressure regulator on the supply, and check whether an expansion tank exists at all.
The flow explanation
A restricted outlet, a partly closed valve, or a scaled heat exchanger makes the water boil locally. That is the kettle sound, and it is the one to take seriously.
What helps
Flush the tank to remove loose sediment. If the noise persists, the bonded layer needs more than a drain: chemical cleaning or mechanical removal, and sometimes the tank is too far gone to justify it.
What does not help
Turning the temperature down hides the symptom for a while, and it does not remove the scale. It also leaves a tank running at a setting chosen for the noise rather than the household.
When to replace
A tank that bangs, leaks at the base and is past its warranty is not a repair candidate. The noise is one of several signals at that point.