Muscle cramps can be caused by thirst - common among us diabetics, especially on the more exotic types of medications:
https://www.everydayhealth.com/news/unusual-signs-of-dehydration/
Restless legs is a different thing to cramps and can be caused by a great many different things, including all kinds of medication (diabetes related or otherwise), stress and anxiety, more or less exercise than usual... the list is endless. But it's a frustrating condition and can very quickly become distressing - I completely sympathise having suffered with it for 3 months a few years ago.
For me, it was medication-related, and the symptoms subsided as soon (literally the same day) as I stopped taking the particular medication in question (Tamsulosin). The best advice - given that we don't know you, your lifestyle, your stresses and possible other conditions and medications - is to keep a diary of when it happens and how long for and get to your GP.
It's a miserable thing to go through, though. I used to find a brisk walk and then a super-hot, quick bath (and cooling down rapidly) would settle the legs briefly while making me super-sleepy in a blink.
Good luck,
Sock x