How can I bind alias or CNAME to rancher service?

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

  1. the ability to listen for IP change; or
  2. 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.

Does anyone try that?

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.

How can I find the host IP for my load balancer?

I see the public port now using JSON instead plain text. So the problem is resolved.

Any chance you could share some of the implementation notes/details?

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. (for testing outside rancher)

Hope it helps.