Back in the day, I used to do performance distance running. (Mostly, up and down hills ... hard work.) Made sure I was well-hydrated, and made sure I had sufficient nutrition including electrolytes. But, early on particularly, I still occasionally had some cramping. For me, in my case, the hydration and nutrition aspects were in-hand, as was sleep. When I dramatically boosted the amount of strengthening and stretching in the affected muscle areas (ie, calves, shin area muscles, feet [since much training was in the hills on trails]), nearly all of this disappeared. I chalked it up to simply not being sufficiently prepared for the level of challenge I was inflicting upon those muscles. Though, I don't know for certain.
Can't say whether it'd be much the same with you. But, if you think your nutrition and electrolytes are all up to snuff, you might consider a handful of targeted strengthening exercises and stretching to better-prepared those specific muscles. Might well be all it is. Even if it isn't, you wouldn't be any worse off.
A WAG, but something to try.