Certain medical conditions that affect your immune system, such as diabetes, increase your risk of kidney infection. Some medications also increase your risk.