Kubernetes - Automatically populating CloudDNS records from service endpoints

9/30/2016

When running a Kubernetes cluster on Google Cloud Platform is it possible to somehow have the IP address from service endpoints automatically assigned to a Google CloudDNS record? If so can this be done declaratively within the service YAML definition?

Simply put I don't trust that the IP address of my type: LoadBalancer service.

-- AndrewMcLagan
devops
dns
docker
google-cloud-platform
kubernetes

2 Answers

10/13/2016

GKE uses deployment manager to spin new clusters, as well as other resources like Load Balancers. At the moment deployment manager does not allow to integrate Cloud DNS functionality. Nevertheless there is a feature request to support that. In the future If this feature is implemented, it might allow further integration between Cloud DNS, Kubernetes and GKE.

-- Carlos
Source: StackOverflow

4/6/2017

One option is to front your services with an ingress resource (load balancer) and attach it to a static IP that you have previously reserved.

I was unable to find this documented in either the Kubernetes or GKE documentation, but I did find it here:

https://github.com/kelseyhightower/ingress-with-static-ip

Keep in mind that the value you set for the kubernetes.io/ingress.global-static-ip-name annotation is the name of the reserved IP resource, and not the IP itself.

Previous to that being available, you needed to create a Global IP, attach it to a GCE load balancer which had a global forwarding rule targeting at the nodes of your cluster yourself.

I do not believe there is a way to make this work automatically, today, if you do not wish to front your services with a k8s Ingress or GCP load balancer. That said, the Ingress is pretty straightforward, so I would recommend you go that route, if you can.

There is also a Kubernetes Incubator project called "external-dns" that looks to be an add-on that supports this more generally, and entirely from within the cluster itself:

https://github.com/kubernetes-incubator/external-dns

I have not yet tried that approach, but mention it hear as something you may want to follow.

-- numbsafari
Source: StackOverflow