OpenShift: DNS Server Misbehaving

Zhimin Wen
4 min readJan 16, 2023
Image by Arek Socha from Pixabay

I am deploying an Operator based product onto the OpenShift cluster, however the reconciling error message of the operator gives me,

DNS Error: Server Misbehaving. Please check DNS Settings.

Sure enough, the DNS server is having problem. But it worth a study on how the DNS system works in the OpenShift cluster.

Resolving HTTP Handler

Lets have a toy HTTP handler program to resolve a hostname.


func dnscheck(w http.ResponseWriter, r *http.Request) {
host := r.FormValue("host")
resolver := net.Resolver{}
ips, err := resolver.LookupIPAddr(r.Context(), host)
if err != nil {
fmt.Fprintf(w, "Failed to resolve %s: %v", host, err)
return
} else {
fmt.Fprintf(w, "Resolved %s to %v", host, ips)
}
}

Build the container image, push into the OpenShift registry, deploy as a Deployment, expose the service. Then we can test it as below,

We can resolve a service name within in the same namespace. (Command breaks into two lines just for viewing purpose)

curl "http://app-service-dns-misbehaving.apps.dev-ocp410.ibmcloud.io.cpak/\
dnscheck?host=app-service"
Resolved app-service to [{172.30.73.189 }]

We can also resolve a external name such as,

--

--