Agitator making knocking noise, house lights blinking.

Washer fills fine, but when it starts to agitate it is making a knocking noise and my house lights blink. It is working to hard. When I move the dial to rinse and spin cycle it’s fine. Any ideas…:confused: