The ketogenic diet lowers your insulin levels, which causes increased excretion of sodium and potassium. That effect is amplified when you sweat while working out. As a result, you have to increase your intake of sodium and other electrolytes, such as potassium and magnesium, while you're on a keto diet.