Ubuntu 24.04
Sponsored Link

OpenStack Dalmatian : Octavia का उपयोग कैसे करें2024/10/24

 
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           |
+--------------------+----------------+---------------------+------------------+
| 22837749-299e-     | public-subnet  | ce38ba4f-6066-4e93- | 10.0.0.0/24      |
| 4323-bfc3-         |                | ae59-de238fb6ed08   |                  |
| 3120c8c2d635       |                |                     |                  |
| bc45dd3e-0b15-     | private-subnet | 2da36a04-0d3e-4de8- | 192.168.100.0/24 |
| 42ca-a37b-         |                | 9be8-a2972c15bbe4   |                  |
| 94f2feaf341e       |                |                     |                  |
+--------------------+----------------+---------------------+------------------+

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| admin_state_up      | True                                 |
| availability_zone   | None                                 |
| created_at          | 2024-10-24T00:44:44                  |
| description         |                                      |
| flavor_id           | None                                 |
| id                  | 91b072b8-e06a-48e4-b6e8-37c1ea3899c6 |
| listeners           |                                      |
| name                | lb01                                 |
| operating_status    | OFFLINE                              |
| pools               |                                      |
| project_id          | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| provider            | amphora                              |
| provisioning_status | PENDING_CREATE                       |
| updated_at          | None                                 |
| vip_address         | 192.168.100.34                       |
| vip_network_id      | 2da36a04-0d3e-4de8-9be8-a2972c15bbe4 |
| vip_port_id         | f59bb54b-a37a-4bce-a5b5-db663df8f190 |
| vip_qos_policy_id   | None                                 |
| vip_subnet_id       | bc45dd3e-0b15-42ca-a37b-94f2feaf341e |
| vip_vnic_type       | normal                               |
| tags                |                                      |
| additional_vips     | []                                   |
+---------------------+--------------------------------------+

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

ubuntu@dlp ~(keystone)$
openstack loadbalancer list

+-----------+------+------------+-------------+---------------------+------------------+----------+
| id        | name | project_id | vip_address | provisioning_status | operating_status | provider |
+-----------+------+------------+-------------+---------------------+------------------+----------+
| 91b072b8- | lb01 | 84e315c8d6 | 192.168.100 | ACTIVE              | OFFLINE          | amphora  |
| e06a-     |      | 5e4b3cb33a | .34         |                     |                  |          |
| 48e4-     |      | af69c9eed0 |             |                     |                  |          |
| b6e8-     |      | c3         |             |                     |                  |          |
| 37c1ea389 |      |            |             |                     |                  |          |
| 9c6       |      |            |             |                     |                  |          |
+-----------+------+------------+-------------+---------------------+------------------+----------+
[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                  | 2024-10-24T00:47:16                  |
| default_pool_id             | None                                 |
| default_tls_container_ref   | None                                 |
| description                 |                                      |
| id                          | f562d192-85bc-4db6-96e4-2e0fb1bca232 |
| insert_headers              | None                                 |
| l7policies                  |                                      |
| loadbalancers               | 91b072b8-e06a-48e4-b6e8-37c1ea3899c6 |
| name                        | listener01                           |
| operating_status            | OFFLINE                              |
| project_id                  | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| 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                        |                                      |
| hsts_max_age                | None                                 |
| hsts_include_subdomains     | False                                |
| hsts_preload                | False                                |
+-----------------------------+--------------------------------------+

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

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           | 2024-10-24T00:47:49                  |
| description          |                                      |
| healthmonitor_id     |                                      |
| id                   | 0e9135cd-31f9-434e-a2d7-9dc63d62e7ff |
| lb_algorithm         | ROUND_ROBIN                          |
| listeners            | f562d192-85bc-4db6-96e4-2e0fb1bca232 |
| loadbalancers        | 91b072b8-e06a-48e4-b6e8-37c1ea3899c6 |
| members              |                                      |
| name                 | pool01                               |
| operating_status     | OFFLINE                              |
| project_id           | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| 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   |
+------------------+-------+--------+------------------+------------+----------+
| fb215355-6d93-   | Web02 | ACTIVE | private=192.168. | Ubuntu2404 | m1.small |
| 4d73-bc99-       |       |        | 100.138          |            |          |
| 453a9c674d62     |       |        |                  |            |          |
| 605d794e-6cbd-   | Web01 | ACTIVE | private=192.168. | Ubuntu2404 | m1.small |
| 4cea-abc2-       |       |        | 100.181          |            |          |
| 5a1074ccec70     |       |        |                  |            |          |
+------------------+-------+--------+------------------+------------+----------+

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

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| address             | 192.168.100.138                      |
| admin_state_up      | True                                 |
| created_at          | 2024-10-24T01:02:53                  |
| id                  | 9172971b-f525-4ace-ac9c-5c53c9052bc2 |
| name                |                                      |
| operating_status    | NO_MONITOR                           |
| project_id          | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| protocol_port       | 80                                   |
| provisioning_status | PENDING_CREATE                       |
| subnet_id           | bc45dd3e-0b15-42ca-a37b-94f2feaf341e |
| updated_at          | None                                 |
| weight              | 1                                    |
| monitor_port        | None                                 |
| monitor_address     | None                                 |
| backup              | False                                |
| tags                |                                      |
| vnic_type           | normal                               |
+---------------------+--------------------------------------+

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| address             | 192.168.100.181                      |
| admin_state_up      | True                                 |
| created_at          | 2024-10-24T01:03:07                  |
| id                  | dadcb676-5dcc-40d3-958b-3232b0ea3996 |
| name                |                                      |
| operating_status    | NO_MONITOR                           |
| project_id          | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| protocol_port       | 80                                   |
| provisioning_status | PENDING_CREATE                       |
| subnet_id           | bc45dd3e-0b15-42ca-a37b-94f2feaf341e |
| updated_at          | None                                 |
| weight              | 1                                    |
| monitor_port        | None                                 |
| monitor_address     | None                                 |
| backup              | False                                |
| tags                |                                      |
| vnic_type           | normal                               |
+---------------------+--------------------------------------+

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

+----------+------+------------+---------------------+----------+---------------+------------------+--------+
| id       | name | project_id | provisioning_status | address  | protocol_port | operating_status | weight |
+----------+------+------------+---------------------+----------+---------------+------------------+--------+
| 9172971b |      | 84e315c8d6 | ACTIVE              | 192.168. |            80 | NO_MONITOR       |      1 |
| -f525-   |      | 5e4b3cb33a |                     | 100.138  |               |                  |        |
| 4ace-ac9 |      | af69c9eed0 |                     |          |               |                  |        |
| c-       |      | c3         |                     |          |               |                  |        |
| 5c53c905 |      |            |                     |          |               |                  |        |
| 2bc2     |      |            |                     |          |               |                  |        |
| dadcb676 |      | 84e315c8d6 | ACTIVE              | 192.168. |            80 | NO_MONITOR       |      1 |
| -5dcc-   |      | 5e4b3cb33a |                     | 100.181  |               |                  |        |
| 40d3-    |      | af69c9eed0 |                     |          |               |                  |        |
| 958b-    |      | c3         |                     |          |               |                  |        |
| 3232b0ea |      |            |                     |          |               |                  |        |
| 3996     |      |            |                     |          |               |                  |        |
+----------+------+------------+---------------------+----------+---------------+------------------+--------+

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

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

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2024-10-24T01:04:03Z                 |
| description         |                                      |
| dns_domain          |                                      |
| dns_name            |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.228                           |
| floating_network_id | ce38ba4f-6066-4e93-ae59-de238fb6ed08 |
| id                  | 0d4efa8e-68d0-42be-a908-c76202b33f3f |
| name                | 10.0.0.228                           |
| port_details        | None                                 |
| port_id             | None                                 |
| project_id          | 84e315c8d65e4b3cb33aaf69c9eed0c3     |
| qos_policy_id       | None                                 |
| revision_number     | 0                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| subnet_id           | None                                 |
| tags                | []                                   |
| updated_at          | 2024-10-24T01:04:03Z                 |
+---------------------+--------------------------------------+

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

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.228
# फ़्लोटिंग आईपी तक पहुंचने के लिए सेटिंग्स सत्यापित करें

ubuntu@dlp ~(keystone)$
curl 10.0.0.228

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

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

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

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