# Slow CoreDNS queries response and timeouts

**URL:** <https://discuss.kubernetes.io/t/slow-coredns-queries-response-and-timeouts/31697>\
**Category:** General Discussions\
**Created:** [February 26, 2025, 11:16am UTC](https://discuss.kubernetes.io/t/slow-coredns-queries-response-and-timeouts/31697 "2025-02-26T11:16:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![titanve](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/titanve/32/16949_2.png) [@titanve](https://discuss.kubernetes.io/u/titanve)\
**Post date:** [February 26, 2025, 11:16am UTC](https://discuss.kubernetes.io/t/slow-coredns-queries-response-and-timeouts/31697/1 "2025-02-26T11:16:01Z")

</div>

### Cluster information:

Kubernetes version:

```auto
kubectl version
Client Version: v1.29.14
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.14

```

Cloud being used: bare-metal  
Installation method:  
Host OS: AlmaLinux 8  
CNI and version: Flannel ver: `0.26.4`  
CRI and version: `cri-dockerd` ver: `0.3.16`

Hi, for Google APIs I’m getting slow CoreDNS responses and timeouts, I have tried for days to discover where the error might be without luck, any suggestions to fix this issue?

I am using the `node:18-alpine` image which has alpine ver `3.21.3`

Thanks.

---

<div class="post-metadata">

**Author:** ![titanve](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/titanve/32/16949_2.png) [@titanve](https://discuss.kubernetes.io/u/titanve)\
**Post date:** [March 5, 2025, 12:15am UTC](https://discuss.kubernetes.io/t/slow-coredns-queries-response-and-timeouts/31697/2 "2025-03-05T00:15:54Z")

</div>

When I run this commands it works but then it stops working when I reboot the server:

```bash
nft flush ruleset

nft add rule ip nat POSTROUTING ip saddr 10.244.0.0/16 ip daddr != 224.0.0.0/4 masquerade

nft add rule ip filter FORWARD ip saddr 10.244.0.0/16 ip daddr 10.96.0.0/12 accep

```

---

<div class="post-metadata">

**Author:** ![titanve](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/titanve/32/16949_2.png) [@titanve](https://discuss.kubernetes.io/u/titanve)\
**Post date:** [March 5, 2025, 1:39am UTC](https://discuss.kubernetes.io/t/slow-coredns-queries-response-and-timeouts/31697/3 "2025-03-05T01:39:39Z")

</div>

If run this command:

```bash
[root@master k8s]# kubectl exec -it -n server-api server-55d7fdc87b-hpfwm -- nslookup google.com 10.96.0.10
nslookup: write to '10.96.0.10': Host is unreachable
;; connection timed out; no servers could be reached

command terminated with exit code 1

```

I get this reply

```bash
[root@master ~]# tcpdump -i any host 10.96.0.10 -n
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked v1), capture size 262144 bytes
22:38:23.848680 IP 10.244.0.102.46942 > 10.96.0.10.domain: 40402+ A? google.com. (28)
22:38:23.848680 IP 10.244.0.102.46942 > 10.96.0.10.domain: 40402+ A? google.com. (28)
22:38:23.848838 IP 10.96.0.10 > 10.244.0.102: ICMP host 10.96.0.10 unreachable - admin prohibited filter, length 64
22:38:23.848846 IP 10.96.0.10 > 10.244.0.102: ICMP host 10.96.0.10 unreachable - admin prohibited filter, length 64

```

---

<div class="post-metadata">

**Author:** ![fox-md](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/fox-md/32/10613_2.png) [@fox-md](https://discuss.kubernetes.io/u/fox-md)\
**Post date:** [March 7, 2025, 9:33am UTC](https://discuss.kubernetes.io/t/slow-coredns-queries-response-and-timeouts/31697/4 "2025-03-07T09:33:15Z")

</div>

Hi,  
Are you trying to connect to CoreDNS pods from the master node?

---

<div class="post-metadata">

**Author:** ![titanve](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/titanve/32/16949_2.png) [@titanve](https://discuss.kubernetes.io/u/titanve)\
**Post date:** [March 7, 2025, 10:42am UTC](https://discuss.kubernetes.io/t/slow-coredns-queries-response-and-timeouts/31697/5 "2025-03-07T10:42:32Z")

</div>

Hi! I’m trying to get my NodeJS API app to resolve the Google APIs OAuth2 address. If I replace the CoreDNS Service IP address (`10.96.0.10`) with the CoreDNS Pod IP address it resolves but it does not work with the Service IP address.

Also If I run these commands, in the `master` node, it starts working with the Service IP address, the one saved in the Pod `/etc/resolv.conf`:

```bash
nft flush ruleset

nft add rule ip nat POSTROUTING ip saddr 10.244.0.0/16 ip daddr != 224.0.0.0/4 masquerade

nft add rule ip filter FORWARD ip saddr 10.244.0.0/16 ip daddr 10.96.0.0/12 accept

```

---

<div class="post-metadata">

**Author:** ![titanve](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/titanve/32/16949_2.png) [@titanve](https://discuss.kubernetes.io/u/titanve)\
**Post date:** [March 8, 2025, 11:30am UTC](https://discuss.kubernetes.io/t/slow-coredns-queries-response-and-timeouts/31697/6 "2025-03-08T11:30:34Z")

</div>

I added this to the pod’s deployment config yaml file and it started working:

```yaml
  spec:
    dnsPolicy: "None"
      dnsConfig:
        nameservers:
          - 8.8.8.8
          - 8.8.4.4
          - 1.1.1.1

```

I understand that I am not fixing the routing problem but at least my API NodeJS app can resolve the google apis addresses.
