Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes - Automatically populating CloudDNS records from service endpoints

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.

like image 552
AndrewMcLagan Avatar asked Sep 30 '16 00:09

AndrewMcLagan


1 Answers

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.

like image 191
numbsafari Avatar answered Nov 04 '22 04:11

numbsafari