Add-on dns

This deploys CoreDNS to supply address resolution services to
Kubernetes.

This service is commonly required by other addons, so it is
recommended that you enable it.

microk8s enable dns

By default it points to Google’s 8.8.8.8 and 8.8.4.4 servers for resolving
addresses. This can be changed when you enable the addon, for example:

microk8s enable dns:1.1.1.1

(for multiple DNS addresses, a comma-separated list should be used)

The forward dns servers can also be altered after enabling the addon
by running the command:

microk8s kubectl -n kube-system edit configmap/coredns

This will invoke the vim editor so that you can alter the configuration.

The addon can be disabled at any time:

microk8s disable dns

…but bear in mind this could have implications for services and pods which
may be relying on it.

2 Likes

Good afternoon

When I execute:

microk8s enable dns:MY-INTERNAL-DNS

if I use one server is ok, but two ou more the resolution is broken.

are you using the right syntax? The scripts which enable it support a comma separated list, e.g:

microk8s enable dns:8.8.8.8,8.8.4.4

Good Morning.

Alright?

In this case, I can successfully configure the internal DNS, as long as I use only one server. When I add two or more the resolution stops working.

I believe this problem is specific, but I would like continue using the mk8s, but in this moment is impossible.

The issue is resolving hosts that is not within the cluster? From pod to pod does it work?
Thanks

When I change the DNS configuration to my internal DNS, example 192.168.10.10 (DNS server), it works for both the internal addresses on my network and the public ones. Also the svc cluster address.

The problem occurs when I increase the number of cluster nodes. Resolution no longer works.

I would add to the docs something along the lines of:

You can verify the addon is ready using:
sh -c "until microk8s.kubectl rollout status deployments/coredns -n kube-system -w; do sleep 5; done"

I’m having the same issue with microk8s. Everything was working perfect with a single node. After adding another node, pods that are deployed there can’t be accesible.

If i try “microk8s kubectl get pods --all-namespaces” I can see that the pods are there. But if i try “microk8s kubectl exec -it name-of-pod bash” it doesn’t work. It seems a DNS issue as I also tried 'ping name-of-pod" and it can’t resolve.

In the dashboard I can see everything up and running, but the apps are broken.

Kind of sad that multinode are not fully working (or maybe i’m making a mistake…)

Any suggestion?

Try adding your node’s hostname and IP to each of the cluster node’s /etc/hosts

1 Like

Hi,

May I know any instructions for the end-user to change the daemonset to put the selector like kubernetes.io/os=linux. e.g. Coredns? Thanks!