How to create a domain (virtual one and not really set on a DNS server and not a registered one) to an IP using coredns

7/19/2019

I have the latest Kubernetes installed (1.15.0), i want to create a custom domain in coredns and map it to the public ip of the worker node.

I tried installing metallb and give it already the public ip assigned to the VM as a range but still I can not like the public ip mapped to a custom domain which is not the same as the cluster domain.

Also for the metallb, my understanding that it can really assign an external ip to the node so that when I do kubectl get nodes -o wide I can see the node taking an external ip but that is not happening, any advice?

I tried multiple configurations to metallb, the layer 2 one https://metallb.universe.tf/configuration/

I tried updating the coredns configmap but it is not working, i tried adding a db file in it but is not accepting it and tried the forward and it is the same:


apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns
  namespace: kube-system
data:
    Corefile: |
     #xxx.com {
      # proxy xx.com xxxx:443
     #}
     .:53 {
         log stdout
         health
         # Replace cluster.local with your cluster domain
         kubernetes cluster.local
         proxy . /etc/resolv.conf
         cache 30
     }
     xx.com:53 {
         errors
         cache 30
         forward . MY_PUBLIC_IP_ASSIGNED_TO_A_WORKER_NODE
     }
#     xx.db: |
 #     ; xx.com test file
  #    xx.com.            IN      SOA     sns.dns.icann.org. noc.dns.icann.org. 2015082541 7200 3600 1209600 3600
   #   xx.com.            IN      NS      b.iana-servers.net.
    #  xx.com.            IN      NS      a.iana-servers.net.
     # xx.com.            IN      A       xxxxxxxx
     # a.b.c.w.xx.com.    IN      TXT     "Not a wildcard"
     # cname.xx.com.      IN      CNAME   www.example.net.
     # service.cap.com.    IN      SRV     8080 10 10 cap.com.
     # *.xxx.com           IN      A       xxxxxx

~
~
~
~
~
~
~

I just want when i do nslookup on the domain the pod is able to resolve it and map it to my external ip and also would like the external ip to be mapped to the worker node.

-- rasadus
coredns
kubernetes
metallb

0 Answers