9

Can someone please detail the steps necessary to install the kube-dns addon? I've downloaded the nearly 400MB git repo in the previous link and run make as instructed but get Nothing to be done for 'all'.

The docs aren't clear what form add-ons exist in, and how to install them. The "Administrators guide" link there takes me to this unhelpful page.

I've tried https://stackoverflow.com/a/42315074/4978821, but got an error validating data message. Even if this worked, it seems like it'd be an unofficial and awkward solution.

Answers like this are also too vague: https://stackoverflow.com/a/36105547/4978821.

I'd be happy to create a pull request to improve the documentation, once I have a solution.

Updated to clarify my issue:

As mentioned by Aaron, the dns addon is enabled in minikube by default. Running minikube addons list shows that it is enabled. However, if I get into a bash shell for a running pod, like such kubectl exec -it node-controller-poqsl bash and try to reach my mongo service using ping, for example, it resolves to a public URL, rather than the kubernetes service IP.

Community
  • 1
  • 1
l p
  • 528
  • 1
  • 7
  • 17
  • That's the same link I included in my post. That link is to yaml templates. Running `make` as suggested in that link yields nothing, as I mentioned in my post. I still don't see clear steps to arrive at a usable yaml file. – l p Apr 01 '17 at 13:16

2 Answers2

7

The kube-dns addon should be enabled by default in minikube. You can run kubectl get po -n kube-system to check if the pod the addon-manager launches is there. If you don't see the pod listed, make sure that the addon is enabled in minikube by running minikube addons list and verifying that kube-dns is enabled

Edit: For me kubectl get po -n kube-system is a valid command, here is the output:

$ kubectl get po -n kube-system
NAME                          READY     STATUS    RESTARTS   AGE
kube-addon-manager-minikube   1/1       Running   2          5d
kube-dns-v20-7ddvt            3/3       Running   6          5d
kubernetes-dashboard-rn54g    1/1       Running   2          5d

You can see from this that the kube-dns pods are running correctly. Can you verify that your kube-dns pods are in the Running state?

Jiri Kremser
  • 12,471
  • 7
  • 45
  • 72
aaron-prindle
  • 3,077
  • 1
  • 17
  • 15
  • Would you have a reference URL? `kubectl get po -n kube-system` is an invalid command. And, actually, `minikube addons list` does show that kube-dns is enabled. Magic. Though, broken. I'm unable to use a service name in my endpoint controller successfully as it resolves to a public IP rather than one internal to the minikube. Guess I might need to go down a different route. (you have a few typos, but less than 10 chars so SO won't let me fix) – l p Apr 01 '17 at 05:02
  • I have edited my original post to have more information. I do not quite understand what the issue you're having w/ kube-dns is, could you provide some yamls or an example in the original question? – aaron-prindle Apr 01 '17 at 20:34
  • I've narrowed the scope of my question to minikube. Since you correctly responded that kube-dns is enabled by default, and the `minikube addons list` does show that it is installed and running, I'm marking this as the answer. It's another question as to why it's not working (resolving public IP rather than k8s service IP). If I continue to pursue this, I'll dig deeper and open up a new question if it is still not resolved. – l p Apr 02 '17 at 00:09
  • _"The kube-dns addon should be enabled by default in minikube."_ sorry, it's not in `minikube version: v1.15.1`. The only addon with `dns` is `ingress-dns` which is disabled too. On to searching a solution... – Jacek Laskowski Dec 06 '20 at 10:33
  • Found [this](https://stackoverflow.com/q/56599910/1305344) and seems OK. – Jacek Laskowski Dec 06 '20 at 10:35
1

This fix is for VirtualBox drivers only - confirm your driver with

cat ~/.minikube/machines/minikube/config.json | grep DriverName

The accepted answer is correct that kube-dns is installed and enabled by default. But it seems to be a common problem that the pods to manage DNS are not created, making it seem that kube-dns has not been installed.

Eg:

$ kubectl get po -n kube-system
kube-addon-manager-minikube   1/1       Running   1          1m

You can confirm kube-dns is installed and enabled (even though not working) with:

$ minikube addons list
- addon-manager: enabled
- dashboard: enabled
- kube-dns: enabled
{snipped}

The underlying problem is VirtualBox related, as described here: https://forums.virtualbox.org/viewtopic.php?f=7&t=50368

Fix:

minikube stop    
VBoxManage modifyvm "VM name" --natdnshostresolver1 on
minikube start

kubectl get all -n kube-system

VM name is probably "minikube". If the last command doesn't return a large list of pods (including kube-dns and kube-dashboard), wait a few moments - I have a few blank results before success.

For Windows users, VBoxManage is installed by default at c:\Program Files\Oracle\VirtualBox

Further information at https://superuser.com/questions/641933

Dick Chesterwood
  • 2,629
  • 2
  • 25
  • 33