DNS resolution inside LKE kubernetes not working

Linode Staff

For some reason DNS resolution inside my kubernetes is not working: psql.default.svc.cluster.local could not be resolved (3: Host not found). Using a direct IP works.

Checking host from a test pod works: psql.test.pod.cluster.local has address 10.10.10.1

Endpoints are:

NAME           ENDPOINTS            AGE
kubernetes     192.168.128.27:6443   2d13h
package-repo   10.2.0.30:8080       168m
psql           10.2.0.27:5432       82m

pod -o wide:

NAME                            READY   STATUS    RESTARTS   AGE     IP          NODE                        NOMINATED NODE   READINESS GATES
dnsutils                        1/1     Running   0          20m     10.2.0.29   lke5178-6252-5fr4cb31ac7f   <none>           <none>
package-repo-67f47d87f7-pjpsb   1/1     Running   0          7m38s   10.2.0.30   lke5178-6252-5fr4cb31ac7f   <none>           <none>
psql-d99d4868c-c9v57            1/1     Running   0          62m     10.2.0.27   lke5178-6252-5fr4cb31ac7f   <none>           <none>

All system pods are functional:

NAME                                      READY   STATUS    RESTARTS   AGE
calico-kube-controllers-77587f49b-snow   1/1     Running   6          2d13h
calico-node-55zfs                         1/1     Running   1          2d13h
coredns-6955765f44-2kx49                  1/1     Running   1          2d13h
coredns-6955765f44-6snbn                  1/1     Running   1          2d13h
csi-linode-controller-0                   3/3     Running   3          2d13h
csi-linode-node-5p4j7                     2/2     Running   2          2d13h
kube-proxy-963jp                          1/1     Running   1          2d13h

Really strange. What could be wrong?

1 Reply

We recently had a customer run into this, and here's the solution they found:

Using NGINX, you'll have to use the Kubernete's resolver, and you have to use the Fully Qualified Domain Name (FQDN) to any pods.

Here are the resources they found that helped them:

https://stackoverflow.com/questions/40682677/dns-does-not-resolve-with-nginx-in-kubernetes

https://serverfault.com/questions/876308/kubernetes-dns-resolver-in-nginx

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct