How to interpret the A records created by Kubernetes

3/5/2018

According to the Kubernetes documentation, services of the ClusterIP type will populate a DNS A type record with the following schema:

pod-ip-address.my-namespace.pod.cluster.local

I am having difficultly parsing this schema into a resolvable address for my application.

For example, suppose I have the following service:

subway-explorer-gmaps-proxy-service   ClusterIP   10.35.252.232   <none>   9000/TCP   19m

What will the corresponding DNS record be?

-- Aleksey Bilogur
dns
kubernetes

1 Answer

3/5/2018

If your application is in the same namespace as the service you wish to consume, you can use the servicename:

subway-explorer-gmaps-proxy-service

as the DNS name. Kube dns will resolve to the service IP.

If your application is not in the same namespace as that service, services get a DNS name of

$service.$namespace.svc.cluster.local

e.g. if the service was created in the default namespace, it will get

subway-explorer-gmaps-proxy-service.default.svc.cluster.local

Those names are resolvable anywhere in the cluster.

https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/

-- Jonah Benton
Source: StackOverflow