K8s local on-premise setup not able to resolve dns name

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version:
Client Version: v1.31.1
Kustomize Version: v5.4.2
Server Version: v1.31.0
Cloud being used: (put bare-metal if not on a public cloud)
Installation method: local
Host OS: red hat 9.4
CNI and version: flannel
CRI and version: cri-docker + docker

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

A little back ground on this. I am trying to setup kubernetes off premise without internet and the off premise setup does not have a dns server. So what i did was to self create a dns server on the red hat host itself using dnsmasq. For the setup i am running it on a internal created internal network adapter with 3 host - windows os host runing the hyper v with static ip of 192.168.100.79, red hat 9.4 control plane with static ip of 192.168.100.155 and red hat 9.4 worker node with static ip of 192.168.100.156.

Problem right now is that i am not able to get the service name resolved. Basically when pinging the pod ip address and doing a grpcurl (because all the pods are hosting grpc services) i am able to see the methods but when i do a grpcurl to the cluster dns ip (the service pointing to the pod). I am not able to do so. So i think the issue comes to the coredns.

for my dnsmasq.conf whenever i put listening ip as 0.0.0.0 my core dns pod will get the error:

after setting the dnsmasq.conf to have the listening ip to be 192.168.100.155. the errors goes away but i still get the same issue being that the host name are not able to resolve and doing grpcurl to the cluster ip does not work neither does doing a nslookup with a busybox pod ran using busybox image.

Anyone has any clue on how to resolve this?

i tested using a busy box to run nslookup command and nc -zv command:

/ # nslookup crt-tc-upload-grpc-service.default.svc.cluster.local
;; connection timed out; no servers could be reached

/ # nc -zv crt-tc-upload-grpc-service 8080
nc: bad address ‘crt-tc-upload-grpc-service’

somehow in the coredns log it shows that there is no error?:

[INFO] 10.244.1.160:46389 - 19342 “A IN crt-tc-upload-grpc-service.default.svc.cluster.local. udp 70 false 512” NOERROR qr,aa,rd 138 0.0002065s
[INFO] 10.244.1.160:46389 - 46006 “AAAA IN crt-tc-upload-grpc-service.default.svc.cluster.local. udp 70 false 512” NOERROR qr,aa,rd 163 0.0003078s
[INFO] 10.244.1.144:42402 - 62360 “AAAA IN mcsmongodb.default.svc.cluster.local. udp 54 false 512” NOERROR qr,aa,rd 147 0.0001724s
[INFO] 10.244.1.144:42402 - 33178 “A IN mcsmongodb.default.svc.cluster.local. udp 54 false 512” NOERROR qr,aa,rd 106 0.000216s
[INFO] 10.244.1.160:46389 - 46006 “AAAA IN crt-tc-upload-grpc-service.default.svc.cluster.local. udp 70 false 512” NOERROR qr,aa,rd 163 0.0002852s
[INFO] 10.244.1.160:46389 - 19342 “A IN crt-tc-upload-grpc-service.default.svc.cluster.local. udp 70 false 512” NOERROR qr,aa,rd 138 0.0004063s

why if there is no error why it is not returning a response?
Could the issue be with my upstream dns server?

i have disable firewalld and SELinux (set to permissive mode already) and i have set the ipv4 to forward as well.