The best sources of magnesium and potassium on a keto diet include non-starchy vegetables such as spinach, kale, and broccoli. Avocado, nuts, and seeds like pumpkin and chia seeds are also great sources of these nutrients.