Algebraic groups with good reduction