In an ideal world we would get all of our vitamins and minerals from our diet, but for a whole variety of reasons that's not always the case... Poor soil quality, grain fed cattle, reduced offal intake, treated water, cooking practice, use of sunscreen, poor gut health/ microbiome etc.. to mention just a few are reasons why we might be deficient. As people get older, our ability to absorb vitamins and minerals isn't as efficient and stomach acid levels tend to reduce.
As far as Vitamin D is concerned, it's very difficult if to get enough from diet alone and so getting a decent quality supplement is certainly proven to be beneficial and some people simply cannot synthesize Vit D naturally (Vit D is actually a hormone and is naturally sythesized by sunlight from cholesterol in our bodies). The ones I take are in like a liquid gel capsule D3 cholecalciferol and I take them with a meal containing healthy fat to aid absorption (this is then converted to the active Vit D in the liver) - They work, because I've seen signifcant improvement in measured Blood Vit D levels. Personally with the Vitamin K and Magnesium, I tend to supplement on the basis of knowing I have a definite base level, but I'll also have a handfull of walnuts or almonds for magnesium most days & Vit K from green veg, berries etc..
I don't think we should look at supplements as an alternative to healthy eating at all though (definitely not)...The best way to get your Vitamins and Minerals is definitely through a healthy diet.