I have Minikube running Kubernetes version 1.18.2. The Minikube is running stock CoreDNS as well. I need to introduce a DNS alias for my sevice coolservice. The service is available under standard coolservice, coolservice.default and coolservice.default.svc.cluster.local DNS names. I would like my service to be also available under the domain coolservice.foo.bar.
I'm trying to use the DNS rewrite plugin for that purpose. This is my Corefile configuration:
apiVersion: v1
data:
Corefile: |
.:53 {
[... unchanged ...]
}
foo.bar {
rewrite name exact coolservice.foo.bar coolservice.default.svc.cluster.local
}
kind: ConfigMap
metadata:
[... unchanged ...]
After I apply the Corefile with kubectl, I'm stating shell in another pod, and I'm trying to resolve the domain with host and curl. Unfortunately, if fails with error Question section mismatch:
root@aks-ssh:/# host coolservice.default.svc.cluster.local
coolservice.default.svc.cluster.local has address 10.108.195.164
root@aks-ssh:/# host coolservice.foo.bar
;; Question section mismatch: got coolservice.default.svc.cluster.local/A/IN
;; Question section mismatch: got coolservice.default.svc.cluster.local/A/IN
;; connection timed out; no servers could be reached
root@aks-ssh:/# curl -X GET coolservice.default.svc.cluster.local:8100/health
{"results":[],"compositeStatus":"Healthy"}
root@aks-ssh:/# curl -X GET coolservice.foo.bar:8100/health
curl: (6) Could not resolve host: coolservice.foo.bar
In this documentation section it's written that when using exact name rewrite rules, the answer gets rewritten automatically. I've tried regex rules as well. Any idea what can be wrong here? (I've tried to configure it on AKS cluster as well, the same problem.).