Nocturnal leg cramps are very common and can affect any muscle group. Their pathophysiology is unknown. Most cases occur in isolation, but they are associated with enough bad health conditions to make it worth talking to your doctor if you haven’t already and ignoring the folk remedies and one-off anecdotes you’re going to get on the internet.
Potassium supplements are irritating to the GI tract and have no use for anyone with a healthy diet who is not losing potassium due to kidney disease or diuretic use.