0
votes

Does the Kubernetes support for DNS SRV lookups allow for a Service using externalName and if so, how to allow a pod access to that record? The use case I have is an externally provided service where a third party defines the port number and I'd like to represent that in the same place as the CNAME, i.e. the k8s Service.

I had go using a simple nslookup query inside a pod with dnsPolicy set to ClusterFirst and it seems to work for the default kubernetes service which is internal:

x nslookup -type=SRV _https._tcp.kubernetes.default.svc
Server: 10.3.0.10
Address: 10.3.0.10#53

_https._tcp.kubernetes.default.svc.cluster.local    service = 10 100 443 kubernetes.default.svc.cluster.local.

But I tried with one of my own Services which uses externalName plus a named port and it cannot be found.

I'm using k8s 1.6.1 and kube-dns 1.9 (admittedly 1.9 is a bit "old", I will upgrade it shortly).

1

1 Answers

1
votes

The docs says following:

An ExternalName service is a special case of service that does not have selectors. It does not define any ports or endpoints. Rather, it serves as a way to return an alias to an external service residing outside the cluster.

So I don't think it is possible to add ports information in the same service definition.

And when accessing this service your application can do this:

curl k8s_svc_name:third_party_defined_port_number

What is the problem in using that?