# LB targeting alias service

**URL:** https://forums.suse.com/t/lb-targeting-alias-service/803
**Category:** Rancher 1.x
**Created:** [October 28, 2015, 2:37pm UTC](https://forums.suse.com/t/lb-targeting-alias-service/803 "2015-10-28T14:37:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kaos](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kaos/32/38_2.png) [@kaos](https://forums.suse.com/u/kaos)
#### Post date: [October 28, 2015, 2:37pm UTC](https://forums.suse.com/t/lb-targeting-alias-service/803/1 "2015-10-28T14:37:04Z")

</div>

Continuing the discussion from [Load Balancer config](http://forums.suse.com/t/load-balancer-config/181/12):

> [@Load Balancer config](https://forums.suse.com/t/load-balancer-config/181/12):
>
> So pointing a load balancer at a hostname is fairly unusual. It’s weird because it’s not clear when to resolve the name into a list of IPs… Every request would be terribly slow, observing the TTL of the DNS record is adding DNS code to the load balancer. So ha-proxy’s (and I believe nginx and most hardware balancers) behavior is to resolve the name on startup and never read it again (until restart).
> 
> That behavior is rather undesirable if `external.com` ever changes. In particular, Amazon ELB regularly changes the target IPs of their balancers, so the name you get for many common SaaS services would regularly break.
> 
> So the UI specifically hides external services that point to a hostname (vs IP addresses) from the dropdown because it’s not supported yet. Your step 2 is basically tricking the UI into allowing that because I don’t recursively follow alias chains when filtering them out 😄
> 
> It appears the backend API doesn’t actually support this either (@alena) so it’s configuring based on an empty list of target IPs, and according to your output not even creating a `backend` entry at all.
> 
> To say we support hostnames I think we’d have to make it work the way users expect, updating periodically according to the hostname’s TTL. I think we’ll need to add-on something that watches the names that are in the config, polls them periodically, and reloads ha-proxy whenever the list of IPs changes.

So, given the above, I would expect a service alias to work when used in a LB, but that doesn’t seem to work either.

But it doesn’t seem to work…

I have a made up example to show what I’ve reduced it to. Lookging at the HAproxy config, I would expect there to be two frontend sections, one for `alias` and one for `app`, but I only get one for `app`. So, the alias one doesn’t seem to work…

```auto
        acl 0_host hdr(host) -i app:9999                                        
        use_backend 74d355d8-72cd-43c8-b7f6-7703aef3f2a4_0_backend if 0_host    

```

With this stack:

```auto
testApp:
  restart: always
  tty: true
  image: nginx
  stdin_open: true
testAlias:
  labels:
    io.rancher.service.hash: 0df56b30668fd75508e1014b02924696ea6c0127
  image: rancher/dns-service
  links:
  - testApp:testApp
testLB:
  restart: always
  ports:
  - '9999'
  labels:
    io.rancher.service.hash: 04e47c9e88b6cb76e7402147d5622bda0381dd4e
    io.rancher.loadbalancer.target.testApp: app=8080
    io.rancher.loadbalancer.target.testAlias: alias=8080
  tty: true
  image: rancher/load-balancer-service
  links:
  - testAlias:testAlias
  - testApp:testApp
  stdin_open: true

```

```auto
testApp:
  scale: 1
testAlias:
  metadata:
    io.rancher.service.hash: e84640c8cc8707f9f7c411aa2a576a387abbf560
testLB:
  scale: 1
  metadata:
    io.rancher.service.hash: 27ed8e7c2afa77b797508795b80ace6b19de3c67

```

Reading the [docs](http://docs.rancher.com/rancher/rancher-ui/applications/stacks/adding-service-alias/) suggest that this should work.

---

<div class="post-metadata">

### Author: ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)
#### Post date: [October 28, 2015, 7:16pm UTC](https://forums.suse.com/t/lb-targeting-alias-service/803/2 "2015-10-28T19:16:13Z")

</div>

This sounds like [https://github.com/rancher/rancher/issues/2047](https://github.com/rancher/rancher/issues/2047) ; I think @alena is getting ready to do a round of balancer fixes.

---

<div class="post-metadata">

### Author: ![kaos](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kaos/32/38_2.png) [@kaos](https://forums.suse.com/u/kaos)
#### Post date: [October 29, 2015, 7:23am UTC](https://forums.suse.com/t/lb-targeting-alias-service/803/3 "2015-10-29T07:23:15Z")

</div>

Thanks @vincent, that does indeed look like what I was experiencing. Plus 1’d. 😉
