I think I can create a service that access to the LB and listen for its IP change. And register the alias or CNAME using my own cloud service. So what I need is
the ability to listen for IP change; or
a rancher API to check for service LB IP.
My goal is to build a resilient FQDN, so even the LB container died, the external application can still consume rancher hosted service without long failure.
I think I find rancher metadata service to do the job but I can’t find the host IP for my load balancer. The host IP doesn’t exist in service metadata. Though I can find the host uuid for its container, but the doc doesn’t mention the endpoint for hosts.
There can be two ways. One is to use rancher API, e.g., /v1/projects//loadbalancerservices would return all the load balancers metadata. The other way is to run a container that queries metadata API, e.g., http://rancher-metadata/2015-12-19/self/stack/services gives me all the metadata and I can check the one whose kind is loadBalancerService, and then use its ports to create the alias.
Also, I’m using Go, so I find the below projects quite useful.