Thjs is most likely caused by a defect in the liner inside your water heater. It is not correctable. Only replacement of the water heater with one with an intact liner is the answer.
Another possible cause is a galvanic cell on the feed water line to your water heater. This is unlikely but possible. The galvanic cell would be wherever dissimilar metals are connected. Such as galvanized iron pipe or fittings are connected to copper pipe or fittings. This causes the iron to be dissolved into the water. To discolor your water in the water heater would mean either many galvanic cells or a lot of galvanized iron pipe with a little bit of copper. Another cause of that could be electrical grounding to you plumbing system.