美文网首页
octavia 负载均衡应用分析

octavia 负载均衡应用分析

作者: cloudFans | 来源:发表于2021-01-29 09:20 被阅读0次
image.png

浮动IP: 即负载均衡器的公网IP 这里是 10.120.24.227

IP 地址: 10.118.43.28 也即是 ha_aip,即haproxy配置文件种的前端ip

vrrp_ip 比如openstack 3 个 controller种的haproxy,keepalived 基于vrrp 发现故障并将vip切换到另一个节点
简单介绍参考: https://www.jianshu.com/p/098e3c825557

lb_network_ip 这个其实就是octavia 负载均衡器对应的amphora虚拟机的主ip,也是负载均衡器的管理ip,要求octavia-worker以及octavia-house-keeping能够直连到。

| lb_network_ip | 10.120.24.186 |
| vrrp_ip | 10.118.41.39 |
| ha_ip | 10.118.43.28 |

登陆到负载均衡器

[root@control01 ~]# ssh -i /etc/kolla/octavia-worker/octavia_ssh_key root@10.120.24.186
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-151-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
Last login: Fri Jan 29 01:18:39 2021 from 10.120.24.21
root@amphora-bd1818e1-be33-404b-b78d-e607e7515829:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1442 qdisc pfifo_fast state UP group default qlen 1000
    link/ether fa:16:3e:c1:5e:57 brd ff:ff:ff:ff:ff:ff
    inet 10.120.24.186/21 brd 10.120.31.255 scope global ens3
       valid_lft forever preferred_lft forever
    inet6 2010:120:31:1:f816:3eff:fec1:5e57/64 scope global mngtmpaddr dynamic
       valid_lft 2591997sec preferred_lft 604797sec
    inet6 fe80::f816:3eff:fec1:5e57/64 scope link
       valid_lft forever preferred_lft forever
root@amphora-bd1818e1-be33-404b-b78d-e607e7515829:~#

| vrrp_ip | 10.118.41.39 | ns amphora-haproxy 主ip
| ha_ip | 10.118.43.28 | ns amphora-haproxy 主ip 对应的网卡子接口 , 负载均衡器的前端ip

10.118.43.28 也是 10.118.41.39 对应的地址对ip

root@amphora-bd1818e1-be33-404b-b78d-e607e7515829:~# ip netns exec amphora-haproxy bash
root@amphora-bd1818e1-be33-404b-b78d-e607e7515829:~#
root@amphora-bd1818e1-be33-404b-b78d-e607e7515829:~# ip a
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1442 qdisc pfifo_fast state UP group default qlen 1000
    link/ether fa:16:3e:21:2f:e9 brd ff:ff:ff:ff:ff:ff
    inet 10.118.41.39/21 brd 10.118.47.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet 10.118.43.28/21 brd 10.118.47.255 scope global secondary eth1:0
       valid_lft forever preferred_lft forever
root@amphora-bd1818e1-be33-404b-b78d-e607e7515829:~#

确定负载均衡器前端IP

root@amphora-bd1818e1-be33-404b-b78d-e607e7515829:~# ps -aux | grep haproxy


root@amphora-bd1818e1-be33-404b-b78d-e607e7515829:~# grep 10.118.43.28 -r /var/lib/octavia/
/var/lib/octavia/237af620-7b77-4728-bc6d-f9cfe7b25214/haproxy.cfg:    bind 10.118.43.28:2380
/var/lib/octavia/bbb53967-1cec-4553-9793-82971add45f0/haproxy.cfg:    bind 10.118.43.28:2379

(py3env) [root@control01 ~]# openstack loadbalancer amphora list | grep 6adbec89-af0c-4596-91c3-ef57150a4341

| bd1818e1-be33-404b-b78d-e607e7515829 | 6adbec89-af0c-4596-91c3-ef57150a4341 | ALLOCATED | STANDALONE | 10.120.24.186 | 10.118.43.28  |

(py3env) [root@control01 ~]# openstack loadbalancer amphora show bd1818e1-be33-404b-b78d-e607e7515829
+-----------------+--------------------------------------+
| Field           | Value                                |
+-----------------+--------------------------------------+
| id              | bd1818e1-be33-404b-b78d-e607e7515829 |
| loadbalancer_id | 6adbec89-af0c-4596-91c3-ef57150a4341 |
| compute_id      | 9de663c0-5586-4ec4-9eb1-2cc8fcd621e8 |
| lb_network_ip   | 10.120.24.186                        |
| vrrp_ip         | 10.118.41.39                         |
| ha_ip           | 10.118.43.28                         |
| vrrp_port_id    | 61b6f687-02dc-43d5-a8ff-744eb5f4a777 |
| ha_port_id      | c9586b3d-43a8-49d1-88b1-91388688f06c |
| cert_expiration | 2023-01-18T11:54:11                  |
| cert_busy       | False                                |
| role            | STANDALONE                           |
| status          | ALLOCATED                            |
| vrrp_interface  | None                                 |
| vrrp_id         | 1                                    |
| vrrp_priority   | None                                 |
| cached_zone     | nova                                 |
| created_at      | 2021-01-28T11:54:10                  |
| updated_at      | 2021-01-28T11:54:42                  |
| image_id        | 2603cfd3-1bd9-49d0-9fa2-d069d9685ea9 |
| compute_flavor  | b3384d16-3d17-4d81-849b-d22bf9e8c8ff |
+-----------------+--------------------------------------+

浮动IP 对应的fix ip 是amphora虚拟机 amphora-haproxy ns种的 网卡子接口ip,也就是ha_ip

| ha_ip | 10.118.43.28 |

(py3env) [root@control01 ~]# openstack floating ip list | grep 10.120.24.227
| 9e57df9f-d533-40e2-81b2-9a3e8e016519 | 10.120.24.227       | 10.118.43.28     | c9586b3d-43a8-49d1-88b1-91388688f06c | 9989ffbf-6c71-47c9-b4bf-a747bc74f734 | 7ff7b55097ef43358a7a3e6cac34fb2f |

那么问题来了,这个流量我感觉是通不了的,好像amphora不是一个虚拟机似地。该虚拟机的主网卡的port和 amphora-haproxy 内部的ip 半毛钱关系都没有。

(py3env) [root@control01 ~]# openstack port list | grep 10.120.24.186
| 63206384-e297-4de4-98dd-74efa2f72e09 |                                                      | fa:16:3e:c1:5e:57 | ip_address='10.120.24.186', subnet_id='e10a8459-5668-40f4-9ee7-8fb228201eb8'   | ACTIVE |
(py3env) [root@control01 ~]# openstack port show 63206384-e297-4de4-98dd-74efa2f72e09
+-------------------------+------------------------------------------------------------------------------+
| Field                   | Value                                                                        |
+-------------------------+------------------------------------------------------------------------------+
| admin_state_up          | UP                                                                           |
| allowed_address_pairs   |                                                                              |
| binding_host_id         | compute003                                                                   |
| binding_profile         |                                                                              |
| binding_vif_details     | port_filter='True'                                                           |
| binding_vif_type        | ovs                                                                          |
| binding_vnic_type       | normal                                                                       |
| created_at              | 2021-01-28T11:54:15Z                                                         |
| data_plane_status       | None                                                                         |
| description             |                                                                              |
| device_id               | 9de663c0-5586-4ec4-9eb1-2cc8fcd621e8                                         |
| device_owner            | compute:nova                                                                 |
| dns_assignment          | None                                                                         |
| dns_domain              | None                                                                         |
| dns_name                | None                                                                         |
| extra_dhcp_opts         |                                                                              |
| fixed_ips               | ip_address='10.120.24.186', subnet_id='e10a8459-5668-40f4-9ee7-8fb228201eb8' |
| id                      | 63206384-e297-4de4-98dd-74efa2f72e09                                         |
| ip_allocation           | None                                                                         |
| mac_address             | fa:16:3e:c1:5e:57                                                            |
| name                    |                                                                              |
| network_id              | 9989ffbf-6c71-47c9-b4bf-a747bc74f734                                         |
| port_security_enabled   | True                                                                         |
| project_id              | 1fe211191bd04e98969d722061b49158                                             |
| propagate_uplink_status | None                                                                         |
| qos_network_policy_id   | None                                                                         |
| qos_policy_id           | None                                                                         |
| resource_request        | None                                                                         |
| revision_number         | 4                                                                            |
| security_group_ids      | c602e234-b46a-4a1c-80a0-5210a3f3bb7e                                         |
| status                  | ACTIVE                                                                       |
| tags                    |                                                                              |
| trunk_details           | None                                                                         |
| updated_at              | 2021-01-28T11:54:19Z                                                         |
+-------------------------+------------------------------------------------------------------------------+

virsh domiflist 可以看到amphora 有两张网卡。host ns用于管理, ha ns用于负载均衡。

相关文章

网友评论

      本文标题:octavia 负载均衡应用分析

      本文链接:https://www.haomeiwen.com/subject/gctqtltx.html