The kidneys are obviously important for the regulation of the composition of extracellular fluids. We do not closely regulate our intake of these substances. The kidneys are the excretory pathway for most substances. The first step is glomerular filtration into Bowman's capsule.
Filtrate is free of formed elements, and almost free of protein.
Then come tubular reabsorption and secretion. Much reabsorption is by active transport, performed by cells in the tubule wall. But water reabsorption is by osmosis. Secretion is active. The result of all this is urine.