Ubuntu 22.04
Sponsored Link

OpenStack Antelope : Octavia का उपयोग कैसे करें2023/09/11

 
OpenStack लोड बैलेंसिंग को एक सेवा (Octavia) के रूप में स्थापित करें।
यह उदाहरण निम्न प्रकार से पर्यावरण पर आधारित है।
------------+--------------------------+--------------------------+------------
            |                          |                          |
        eth0|10.0.0.30             eth0|10.0.0.50             eth0|10.0.0.51
+-----------+-----------+  +-----------+-----------+  +-----------+-----------+
|   [ dlp.srv.world ]   |  | [ network.srv.world ] |  |  [ node01.srv.world ] |
|     (Control Node)    |  |     (Network Node)    |  |     (Compute Node)    |
|                       |  |                       |  |                       |
|  MariaDB    RabbitMQ  |  |      Open vSwitch     |  |        Libvirt        |
|  Memcached  Nginx     |  |     Neutron Server    |  |      Nova Compute     |
|  Keystone   httpd     |  |      OVN-Northd       |  |      Open vSwitch     |
|  Glance     Nova API  |  |  Nginx  iSCSI Target  |  |   OVN Metadata Agent  |
|  Cinder API           |  |     Cinder Volume     |  |     OVN-Controller    |
|                       |  |    Octavia Services   |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1] Octavia क्लाइंट टूल इंस्टॉल करें।
root@dlp ~(keystone)#
apt -y install python3-octaviaclient
[2] किसी भी Openstack उपयोगकर्ता के रूप में लॉगिन करें और लोड बैलेंसर इंस्टेंस बनाएं।
किसी भी नोड पर काम करना ठीक है. (नीचे उदाहरण नियंत्रण नोड पर है)
ubuntu@dlp ~(keystone)$
openstack subnet list

+--------------------------------------+----------------+--------------------------------------+------------------+
| ID                                   | Name           | Network                              | Subnet           |
+--------------------------------------+----------------+--------------------------------------+------------------+
| ca5539a8-0291-4684-9fb3-0f448efacebf | public-subnet  | 5352e6c0-47b3-4df2-84f4-ca048f141e1d | 10.0.0.0/24      |
| feb337ec-215e-406e-8871-196fed2c4207 | private-subnet | ce6e88bc-107a-446b-b2ab-255bab7269fe | 192.168.100.0/24 |
+--------------------------------------+----------------+--------------------------------------+------------------+

ubuntu@dlp ~(keystone)$
openstack loadbalancer create --name lb01 --vip-subnet-id private-subnet

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| admin_state_up      | True                                 |
| availability_zone   | None                                 |
| created_at          | 2023-03-28T05:31:17                  |
| description         |                                      |
| flavor_id           | None                                 |
| id                  | 4a782b9a-1086-4c40-8fa3-f16a1f52a299 |
| listeners           |                                      |
| name                | lb01                                 |
| operating_status    | OFFLINE                              |
| pools               |                                      |
| project_id          | e294bd7c00314facacdb46c36fb54ee9     |
| provider            | amphora                              |
| provisioning_status | PENDING_CREATE                       |
| updated_at          | None                                 |
| vip_address         | 192.168.100.253                      |
| vip_network_id      | ce6e88bc-107a-446b-b2ab-255bab7269fe |
| vip_port_id         | 347cf4dc-fc93-47e3-8449-372832723eeb |
| vip_qos_policy_id   | None                                 |
| vip_subnet_id       | feb337ec-215e-406e-8871-196fed2c4207 |
| tags                |                                      |
| additional_vips     | []                                   |
+---------------------+--------------------------------------+

# कुछ मिनटों के बाद, यदि इंस्टेंस सफलतापूर्वक बनाया गया तो स्थिति [ACTIVE] में बदल जाती है

ubuntu@dlp ~(keystone)$
openstack loadbalancer list

+--------------------------------------+------+----------------------------------+-----------------+---------------------+------------------+----------+
| id                                   | name | project_id                       | vip_address     | provisioning_status | operating_status | provider |
+--------------------------------------+------+----------------------------------+-----------------+---------------------+------------------+----------+
| 4a782b9a-1086-4c40-8fa3-f16a1f52a299 | lb01 | e294bd7c00314facacdb46c36fb54ee9 | 192.168.100.253 | ACTIVE              | OFFLINE          | amphora  |
+--------------------------------------+------+----------------------------------+-----------------+---------------------+------------------+----------+
[3] इंस्टेंस में एक श्रोता और पूल जोड़ें और 2 बैकएंड वेब सर्वर इंस्टेंस का उपयोग करने के लिए लोड संतुलन कॉन्फ़िगर करें।
# एक श्रोता बनाएं जो TCP 80 को सुने

ubuntu@dlp ~(keystone)$
openstack loadbalancer listener create --name listener01 --protocol TCP --protocol-port 80 lb01

+-----------------------------+--------------------------------------+
| Field                       | Value                                |
+-----------------------------+--------------------------------------+
| admin_state_up              | True                                 |
| connection_limit            | -1                                   |
| created_at                  | 2023-03-28T05:33:31                  |
| default_pool_id             | None                                 |
| default_tls_container_ref   | None                                 |
| description                 |                                      |
| id                          | d9ac6d87-dfb2-448c-bf96-270438d25e85 |
| insert_headers              | None                                 |
| l7policies                  |                                      |
| loadbalancers               | 4a782b9a-1086-4c40-8fa3-f16a1f52a299 |
| name                        | listener01                           |
| operating_status            | OFFLINE                              |
| project_id                  | e294bd7c00314facacdb46c36fb54ee9     |
| protocol                    | TCP                                  |
| protocol_port               | 80                                   |
| provisioning_status         | PENDING_CREATE                       |
| sni_container_refs          | []                                   |
| timeout_client_data         | 50000                                |
| timeout_member_connect      | 5000                                 |
| timeout_member_data         | 50000                                |
| timeout_tcp_inspect         | 0                                    |
| updated_at                  | None                                 |
| client_ca_tls_container_ref | None                                 |
| client_authentication       | NONE                                 |
| client_crl_container_ref    | None                                 |
| allowed_cidrs               | None                                 |
| tls_ciphers                 | None                                 |
| tls_versions                | None                                 |
| alpn_protocols              | None                                 |
| tags                        |                                      |
+-----------------------------+--------------------------------------+

# श्रोता के लिए एक पूल जोड़ें

ubuntu@dlp ~(keystone)$
openstack loadbalancer pool create --name pool01 --lb-algorithm ROUND_ROBIN --listener listener01 --protocol TCP

+----------------------+--------------------------------------+
| Field                | Value                                |
+----------------------+--------------------------------------+
| admin_state_up       | True                                 |
| created_at           | 2023-03-28T05:33:53                  |
| description          |                                      |
| healthmonitor_id     |                                      |
| id                   | 2d3e21e5-1260-471c-96d9-738a1c285499 |
| lb_algorithm         | ROUND_ROBIN                          |
| listeners            | d9ac6d87-dfb2-448c-bf96-270438d25e85 |
| loadbalancers        | 4a782b9a-1086-4c40-8fa3-f16a1f52a299 |
| members              |                                      |
| name                 | pool01                               |
| operating_status     | OFFLINE                              |
| project_id           | e294bd7c00314facacdb46c36fb54ee9     |
| protocol             | TCP                                  |
| provisioning_status  | PENDING_CREATE                       |
| session_persistence  | None                                 |
| updated_at           | None                                 |
| tls_container_ref    | None                                 |
| ca_tls_container_ref | None                                 |
| crl_container_ref    | None                                 |
| tls_enabled          | False                                |
| tls_ciphers          | None                                 |
| tls_versions         | None                                 |
| tags                 |                                      |
| alpn_protocols       | None                                 |
+----------------------+--------------------------------------+

# वेब सर्वर उदाहरण

ubuntu@dlp ~(keystone)$
openstack server list

+--------------------------------------+-------------+---------+-------------------------------------+------------+-----------+
| ID                                   | Name        | Status  | Networks                            | Image      | Flavor    |
+--------------------------------------+-------------+---------+-------------------------------------+------------+-----------+
| 9a41a257-a90f-4e34-9551-32b7bf1c2605 | Web02       | ACTIVE  | private=192.168.100.215             | Ubuntu2204 | m1.medium |
| 4b935097-4b38-4bd5-b7ba-632265464d34 | Web01       | ACTIVE  | private=192.168.100.136             | Ubuntu2204 | m1.medium |
| 11987eec-fb38-4de1-a386-3d1d6001bbd3 | Ubuntu-2204 | SHUTOFF | private=10.0.0.252, 192.168.100.100 | Ubuntu2204 | m1.medium |
+--------------------------------------+-------------+---------+-------------------------------------+------------+-----------+

# पूल सदस्य में वेब सर्वर इंस्टेंस जोड़ें

ubuntu@dlp ~(keystone)$
openstack loadbalancer member create --subnet-id private-subnet --address 192.168.100.136 --protocol-port 80 pool01

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| address             | 192.168.100.136                      |
| admin_state_up      | True                                 |
| created_at          | 2023-03-28T05:44:23                  |
| id                  | 0f2ba757-e949-4f97-a250-e4cd04710dd6 |
| name                |                                      |
| operating_status    | NO_MONITOR                           |
| project_id          | e294bd7c00314facacdb46c36fb54ee9     |
| protocol_port       | 80                                   |
| provisioning_status | PENDING_CREATE                       |
| subnet_id           | feb337ec-215e-406e-8871-196fed2c4207 |
| updated_at          | None                                 |
| weight              | 1                                    |
| monitor_port        | None                                 |
| monitor_address     | None                                 |
| backup              | False                                |
| tags                |                                      |
+---------------------+--------------------------------------+

ubuntu@dlp ~(keystone)$
openstack loadbalancer member create --subnet-id private-subnet --address 192.168.100.215 --protocol-port 80 pool01

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| address             | 192.168.100.215                      |
| admin_state_up      | True                                 |
| created_at          | 2023-03-28T05:44:42                  |
| id                  | 57e98bf1-5d1b-4e09-a655-e780daec9e32 |
| name                |                                      |
| operating_status    | NO_MONITOR                           |
| project_id          | e294bd7c00314facacdb46c36fb54ee9     |
| protocol_port       | 80                                   |
| provisioning_status | PENDING_CREATE                       |
| subnet_id           | feb337ec-215e-406e-8871-196fed2c4207 |
| updated_at          | None                                 |
| weight              | 1                                    |
| monitor_port        | None                                 |
| monitor_address     | None                                 |
| backup              | False                                |
| tags                |                                      |
+---------------------+--------------------------------------+

ubuntu@dlp ~(keystone)$
openstack loadbalancer member list pool01

+--------------------------------------+------+----------------------------------+---------------------+-----------------+---------------+------------------+--------+
| id                                   | name | project_id                       | provisioning_status | address         | protocol_port | operating_status | weight |
+--------------------------------------+------+----------------------------------+---------------------+-----------------+---------------+------------------+--------+
| 0f2ba757-e949-4f97-a250-e4cd04710dd6 |      | e294bd7c00314facacdb46c36fb54ee9 | ACTIVE              | 192.168.100.136 |            80 | NO_MONITOR       |      1 |
| 57e98bf1-5d1b-4e09-a655-e780daec9e32 |      | e294bd7c00314facacdb46c36fb54ee9 | ACTIVE              | 192.168.100.215 |            80 | NO_MONITOR       |      1 |
+--------------------------------------+------+----------------------------------+---------------------+-----------------+---------------+------------------+--------+

# सार्वजनिक नेटवर्क पर एक फ्लोटिंग आईपी बनाएं

ubuntu@dlp ~(keystone)$
openstack floating ip create public

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2023-03-28T05:45:28Z                 |
| description         |                                      |
| dns_domain          |                                      |
| dns_name            |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.245                           |
| floating_network_id | 5352e6c0-47b3-4df2-84f4-ca048f141e1d |
| id                  | d45b7f04-ebcf-4577-932e-da39408af865 |
| name                | 10.0.0.245                           |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | e294bd7c00314facacdb46c36fb54ee9     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2023-03-28T05:45:28Z                 |
+---------------------+--------------------------------------+

# लोड बैलेंसर इंस्टेंस के आईपी के साथ फ्लोटिंग आईपी को संबद्ध करें

ubuntu@dlp ~(keystone)$
VIPPORT=$(openstack loadbalancer show lb01 | grep vip_port_id | awk {'print $4'})

ubuntu@dlp ~(keystone)$
openstack floating ip set --port $VIPPORT 10.0.0.245
# फ़्लोटिंग आईपी तक पहुंचने के लिए सेटिंग्स सत्यापित करें

ubuntu@dlp ~(keystone)$
curl 10.0.0.245

Web Server on Instance01
ubuntu@dlp ~(keystone)$
curl 10.0.0.245

Web Server on Instance02
ubuntu@dlp ~(keystone)$
curl 10.0.0.245

Web Server on Instance01
ubuntu@dlp ~(keystone)$
curl 10.0.0.245

Web Server on Instance02
मिलान सामग्री