Pyelonephritis usually happens when bacteria enter your urinary tract through the urethra and begin to multiply. Pyelonephritis also can happen if bacteria from an infection elsewhere in your body spread through your bloodstream to your kidneys.