Cephalexin in pregnancy

Is cephalexin 500mg safe to take? I am supposed to take it 3 times a day for 5 days due to a kidney infection. Has anyone else taken this before? I have never taken an antibiotic in my life so I am weary of it.