How to use customise DNS along with cluster.local for kubernetes

12/27/2019

How can we use customized internal DNS for services and Pods? i.e along with cluster.local I wished to use my-domain.local.

For example, both my-svc.my-namespace.svc.cluster.local and my-svc.my-namespace.svc.my-doamin.local need to be resolved to same.

-- Ravichandra
coredns
kubectl
kubernetes

1 Answer

12/27/2019

You can not add your custom domain like that but you can use ingress to route traffic from your domain to the services using name based virtual hosting.

foo.bar.com --|                 |-> foo.bar.com service1:80
              | 178.91.123.132  |
bar.foo.com --|                 |-> bar.foo.com service2:80

https://kubernetes.io/docs/concepts/services-networking/ingress/#name-based-virtual-hosting

-- Arghya Sadhu
Source: StackOverflow