Hi,
I have updated the Coredns config map to add custom-domain so that resolves same as cluster.local. After doing rolling restart pods are stuck in Waiting for kubernetes API before starting server. The syntax also looks good. What am I wrong here.
Showing some code may help explain. When you say you “updated the Coredns config map”, what exactly did you do?
I have added “custom-domain”
k get cm coreds -n kube-system -o yaml apiVersion: v1 data:
Corefile: |
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local custom-domain in-addr.arpa ip6.arpa {
pods insecure fallthrough in-addr.arpa ip6.arpa
††1 30
}
prometheus: 9153
forward . /etc/resolv.conf {
max concurrent 1000
}
cache 30 {
disable success cluster. local disable denial cluster.local
}
loop
reload loadbalance
}
kind: ConfigMap
pod logs
$ kubectl logs --namespace=kube-system - L k8s-app=kube-dns
[INFO] plugin/kubernetes: waiting for Kubernetes API before starting server
.: 53
[INFO] plugin/reload: Running configuration SHA512 = f3f825e1b531bc1d756045795efd4ff640c13fe7d236453fa532c
9f90bd41bac59064dc234fef898a7dlaf6cle0ad77119ce931a48cf4e05d3d71672262793f
CoreDNS-1.11.3
linux/amd64, go1.21.11, a63389
[INFO] plugin/kubernetes: waiting for Kubernetes API before starting server
:53
e [INFO] plugin/reload: Running configuration SHA512 = f3825eb531bcld756045795efd4f640c13fe7d236453a532c
9f90bd41bac59064d234fef898a7dlaf6cle0ad77119ce931a48cf4e05d3d71672262793f
CoreDNS-1.11.3
Linux/amd64, go1.21.11, a63389
nslookup
k exec -it debug2 -- nslookup kubernetes.default.sc.custom-domain.local
Server:
10.96.0.10
re: Address 1: 10.96.0.10 kube-dns.kube-system.sc.cluster.local
Inslookup: can't resolve 'kubernetes.default.svc.custom-domain.local' command terminated with exit code 1
Not sure how best to do this with CoreDNS, but you may want to read this article from Microsoft. I’m not sure if this will work outside of Azure, but it might.