How do kidneys maintain homeostasis?

By removing waste,Or by filtering blood that helps regulate the amount of water in your body.