本节介绍了如何在 Avi Vantage 中为 OpenStack 云配置集群。要提供 NSX Advanced Load Balancer 控制器 HA,请添加两个额外的控制器节点以创建三节点控制器集群。

有关部署集群的更多信息,请参阅部署 NSX Advanced Load Balancer Controller 集群

集群部署的必备条件

为集群中的主节点和从属节点定义了一些必备条件。有关完整信息,请参阅集群部署的必备条件

从 OpenStack 角度来看,请考虑以下事项:

  1. 创建一个 Neutron 端口,并且它可用于集群 VIP。

  2. Neutron 端口可以使用一个浮动 IP。

部署 NSX Advanced Load Balancer 控制器集群

有关配置控制器的管理接口和集群 IP 的完整信息,请参阅部署 NSX Advanced Load Balancer Controller 集群

以下部分用于创建 OpenStack 浮动 IP 并将其与集群 IP 绑定在一起:

写入模式

  1. 访问 OpenStack Horizon CLI。

    1. 列出网络

      openstack network list - 这表示配置的所需网络。

      root@openstack-mitaka:/root# openstack network list
      +--------------------------------------+---------------+------------------------------------------------------+
      | id                                   | name          | subnets                                              |
      +--------------------------------------+---------------+------------------------------------------------------+
      | 10a514a3-d843-499d-80fd-28274d4a4912 | webserver-net | 3ebfb2ef-9b47-44f7-9da5-5245e1d0ed53 192.168.10.0/24 |
      | 5dd0b1cb-ebba-4ff9-84fd-74dcf13c7f86 | client-net    | a9a00d61-6ee8-4fac-80df-4e0bb8c8b4f3 192.168.11.0/24 |
      | c1c045f5-2d0f-43e3-ab43-55f990cde9b7 | provider1     | 1b65c0da-38c7-4c85-88a9-30c52c6a4558 10.130.128.0/18 |
      | dd9dab27-9228-4765-96f2-d56194136ba0 | avimgmt       | 5785c1cf-a222-4b0a-9343-003153f37a65 172.16.0.0/24   |
      +--------------------------------------+---------------+------------------------------------------------------+
    2. 创建浮动 IP。

      openstack floating ip create provider1 - provider1 是使用的网络。

      root@openstack-mitaka:/root# openstack floating ip create provider1

      创建了新的浮动 IP。

      +---------------------+--------------------------------------+
      | Field               | Value                                |
      +---------------------+--------------------------------------+
      | description         |                                      |
      | fixed_ip_address    |                                      |
      | floating_ip_address | 10.130.170.86                        |
      | floating_network_id | c1c045f5-2d0f-43e3-ab43-55f990cde9b7 |
      | id                  | 4ec57a12-7357-461a-80f6-d87ae7536335 |
      | port_id             |                                      |
      | router_id           |                                      |
      | status              | DOWN                                 |
      | tenant_id           | 904fb201a92f443297bffca3b354d52d     |
      +---------------------+--------------------------------------+
    3. 获取集群 IP 的端口 ID。

       openstack port list -c ID -c 'Fixed IP Addresses'|grep 172.16.0.65
           95665123-64a4-453a-abde-70fdb3d2ae2a| ip_address='172.16.0.65', subnet_id='5785c1cf-a222-4b0a-9343-003153f37a65'
    4. 将集群 IP 与浮动 IP 相关联。

      使用上述命令中的端口 ID(在本例中为 95665123-64a4-453a-abde-70fdb3d2ae2a),将其与在步骤 b 中创建的浮动 IP 相关联。

      root@openstack-mitaka:/root# openstack floating ip set --port 95665123-64a4-453a-abde-70fdb3d2ae2a 4ec57a12-7357-461a-80f6-d87ae7536335
      
      +--------------------------+--------------------------------------+
      | Field                    | Value                               |
      +--------------------------+--------------------------------------+
      | description              |                                     |
      | fixed_ip_address         | 172.16.0.65                         |
      | floating_ip_address      | 10.130.170.86                       |
      | floating_network_id      | c1c045f5-2d0f-43e3-ab43-55f990cde9b7|
      | id                       | 4ec57a12-7357-461a-80f6-d87ae7536335|
      | port_id                  | 95665123-64a4-453a-abde-70fdb3d2ae2a|
      | router_id                | 2d3b93a2-7804-4841-90c4-be15b148d099|
      | status                   | ACTIVE                              |
      | tenant_id                | 904fb201a92f443297bffca3b354d52d    |
      +--------------------------+--------------------------------------+
  2. 添加集群 IP 和集群主节点的辅助 IP。

    root@172-16-0-66:~# ip a
    eth0: (BROADCAST,MULTICAST,UP,LOWER_UP) mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:bd:5a:0f brd ff:ff:ff:ff:ff:ff
    inet 172.16.0.66/24 brd 172.16.0.255 scope global eth0
    valid_lft forever preferred_lft forever
    inet 172.16.0.65/32 scope global eth0:1 Cluster IP

无权访问模式

对于 OpenStack 无权访问云类型,需要使用以下命令手动配置 AAP 条目。

在下面的代码块中显示了一个示例。

root@openstack-mitaka:/root# openstack port set --allowed--address ip-address=172.16.0.133 Controller_Port
root@openstack-mitaka:/root#  openstack port set --allowed--address ip-address=172.16.0.133 d0bf0bda-02e2-46bf-abd2-0d05cc4654df
root@openstack-mitaka:/root# openstack port show d0bf0bda-02e2-46bf-abd2-0d05cc4654df    
        +-------------------------------+-----------------------------------------------------------------------------------+
 | Field                    | Value                                                                                  |
 +--------------------------+----------------------------------------------------------------------------------------+
 | admin_state_up           |   True                                                                                 |
 | allowed_address_pairs    |   {"ip_address": "172.16.0.131", "mac_address": "fa:16:3e:47:6b:70"}                   |
 | binding:host_id          |   openstack-mitaka                                                                     |
 | binding:profile          |   {}                                                                                   |
 | binding:vif_details      |   {"port_filter": true}                                                                |
 | binding:vif_type         |   bridge                                                                               |
 | binding:vnic_type        |   normal                                                                               |
 | created_at               |   2018-01-12T13:58:02                                                                  |
 | description              |                                                                                        |
 | device_id                |   2adedfc3-75d6-4296-ad18-bfc38873485c                                                 |
 | device_owner             |   compute:nova                                                                         |
 | extra_dhcp_opts          |                                                                                        |
 | fixed_ips                |   {"subnet_id": "5785c1cf-a222-4b0a-9343-003153f37a65", "ip_address": "172.16.0.133"}  |
 | id                       |   d0bf0bda-02e2-46bf-abd2-0d05cc4654df                                                 |
 | mac_address              |   fa:16:3e:47:6b:70                                                                    |
 | name                     |                                                                                        |
 | network_id               |   dd9dab27-9228-4765-96f2-d56194136ba0                                                 |
 | port_security_enabled    |   True                                                                                 |
 | security_groups          |   3cc1092e-538c-4ff7-b4ac-eeff84731f75                                                 |
 | status                   |   ACTIVE                                                                               |
 | tenant_id                |   904fb201a92f443297bffca3b354d52d                                                     |
 | updated_at               |   2018-01-12T14:19:06                                                                  |
 +--------------------------+----------------------------------------------------------------------------------------+

使用以下命令为 VIP 创建 Neutron 端口。

openstack port create --network "neutron_network_name" --allowed-address mac-address="fa:16:3e:52:81:03",ip-address="172.16.0.63" --allowed-address mac-address="fa:16:3e:52:81:04",ip-address="172.16.0.64" --allowed-address mac-address="fa:16:3e:52:81:06",ip-address="172.16.0.66" --fixed-ip ip-address="172.16.0.65" --project "904fb201a92f443297bffca3b354d52d"

以下是一个示例。

openstack port create --network "neutron_network_name" --allowed-address mac-address="controller_mac1",ip-address="controller_ip1" --allowed-address mac-address="controller_mac2",ip-address="controller_ip2" --allowed-address mac-address="controller_mac3",ip-address="controller_ip3" --fixed-ip ip-address="cluster_ip" --project "project-id"
注:

在主控制器发生故障(或重新引导)时,从属控制器将接管集群 IP(在本例中为 172.16.0.65),并且浮动 IP (10.130.170.86) 和集群 IP (172.16.0.65) 之间的映射不会发生变化。因此,在没有干预的情况下,浮动 IP 和集群 IP 关联将正常工作。