2

Does anyone know how to associate a floating IP address with a load balancer in a heat template? I can create a load balancer on an instance (or a bunch of instances, but starting small) in heat; and can associate a floating IP address to the load balancer in Horizon, but I can't figure out how to do it through heat.

4

2 回答 2

1

我只需要自己找到这个问题的答案。

事实证明,资源的vip属性OS::Neutron::Pool包含的键比此处记录的要多。特别是,该vip属性包含一个port_id,它是与该池关联的 Neutron 端口的地址。

由于我们有一个 Neutron 端口 ID,我们可以使用它来关联一个浮动 IP 地址,如下所示:

type: "OS::Neutron::Pool"
  properties:
    protocol: HTTP
    monitors:
      - {get_resource: monitor}
    subnet_id: {get_resource: fixed_subnet}
    lb_method: ROUND_ROBIN
    vip:
      protocol_port: 80

lb_floating:
  type: "OS::Neutron::FloatingIP"
  properties:
    floating_network_id:
      get_param: external_network_id
    port_id:
      get_attr: [pool, vip, port_id]

get_attr调用正在获取资源port_id属性的vip属性pool

于 2014-09-05T13:21:35.200 回答
0

我对 Octavia 而不是 Neutron 有同样的问题,但是 Larsks 的回答确实为我指明了正确的方向。

OS::Octavia::LoadBalancer对象有一个vip_port_id属性,可以以相同的方式访问:

  port_id:
    get_attr: [lb1, vip_port_id]
于 2020-12-15T11:57:08.437 回答