Pyelonephritis is a urinary tract infection that could affect one or both the kidneys. The infecting organism usually enters the urinary tract through the urethra, into the urinary bladder and then enters the kidneys. Bacteria are the main infecting organisms, but sometimes even viruses can cause the infection.