Cramps (and more specifically leg cramps) are a pretty common thing when starting a ketogenic diet. It’s a sign that there’s a lack of minerals, specifically magnesium, in the body.
Make sure to drink plenty of fluid, have plenty of salt with your food, and eat plenty of low carb vegetables. Doing so can help reduce the loss of magnesium and get rid of the issue.
If the problem persists, try supplementing with a magnesium supplement.