Ubuntu 24.04
Sponsored Link

OpenStack Caracal : Heat का उपयोग कैसे करें2024/05/22

 

OpenStack ऑर्केस्ट्रेशन सेवा (Heat) का उपयोग कैसे करें।

यह उदाहरण निम्न प्रकार से पर्यावरण पर आधारित है।

------------+--------------------------+--------------------------+------------
            |                          |                          |
        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  |  |  Neutron L2/L3 Agent  |  |        Libvirt        |
|  Memcached  Nginx     |  |   Neutron Metadata    |  |      Nova Compute     |
|  Keystone   httpd     |  |     Open vSwitch      |  |    Neutron L2 Agent   |
|  Glance     Nova API  |  |     iSCSI Target      |  |      Open vSwitch     |
|  Neutron Server       |  |     Cinder Volume     |  |                       |
|  Neutron Metadata     |  |     Heat API/Engine   |  |                       |
|  Cinder API           |  |                       |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1] हीट सेवाओं और टेम्पलेट्स के साथ इंस्टेंस तैनात करें। नीचे दिया गया उदाहरण कंट्रोल नोड पर है।
root@dlp ~(keystone)#
apt -y install python3-heatclient
# परीक्षणों के लिए एक टेम्पलेट बनाएं

root@dlp ~(keystone)#
vi sample-stack.yml
heat_template_version: 2021-04-16

description: Heat Sample Template

parameters:
  ImageID:
    type: string
    description: Image used to boot a server
  NetID:
    type: string
    description: Network ID for the server

resources:
  server1:
    type: OS::Nova::Server
    properties:
      name: "Heat_Deployed_Server"
      image: { get_param: ImageID }
      flavor: "m1.small"
      networks:
      - network: { get_param: NetID }

outputs:
  server1_private_ip:
    description: IP address of the server in the private network
    value: { get_attr: [ server1, first_address ] }

root@dlp ~(keystone)#
openstack image list

+--------------------------------------+------------+--------+
| ID                                   | Name       | Status |
+--------------------------------------+------------+--------+
| 7620a182-99f2-4132-9c6e-4b2da962b241 | Ubuntu2404 | active |
+--------------------------------------+------------+--------+

root@dlp ~(keystone)#
openstack network list

+---------------------------------+---------+----------------------------------+
| ID                              | Name    | Subnets                          |
+---------------------------------+---------+----------------------------------+
| 5e99fe3a-c28a-47b3-ae5f-        | public  | 5f767674-473e-402c-ba60-         |
| 504fa513709b                    |         | cc6d6b9e5513                     |
| 78a330d7-074f-491d-a820-        | private | 5ac5f7dc-c275-48a1-aaac-         |
| 2b5e87f5602f                    |         | 745dd2f61ea7                     |
+---------------------------------+---------+----------------------------------+

root@dlp ~(keystone)#
Int_Net_ID=$(openstack network list | grep private | awk '{ print $2 }')
# टेम्पलेट से एक उदाहरण बनाएं

root@dlp ~(keystone)#
openstack stack create -t sample-stack.yml --parameter "ImageID=Ubuntu2404;NetID=$Int_Net_ID" Sample-Stack

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| id                  | 3d7f5aa5-eba7-4801-9d12-a1f3533f9695 |
| stack_name          | Sample-Stack                         |
| description         | Heat Sample Template                 |
| creation_time       | 2024-05-22T01:42:25Z                 |
| updated_time        | None                                 |
| stack_status        | CREATE_IN_PROGRESS                   |
| stack_status_reason | Stack CREATE started                 |
+---------------------+--------------------------------------+

# कुछ मिनट बाद इस प्रकार [CREATE_COMPLETE] पर जाएं

root@dlp ~(keystone)#
openstack stack list

+------------+------------+------------+--------------+---------------+--------------+
| ID         | Stack Name | Project    | Stack Status | Creation Time | Updated Time |
+------------+------------+------------+--------------+---------------+--------------+
| 3d7f5aa5-  | Sample-    | 9c5145f76f | CREATE_COMPL | 2024-05-      | None         |
| eba7-4801- | Stack      | d84324bdd2 | ETE          | 22T01:42:25Z  |              |
| 9d12-      |            | b1b61658a2 |              |               |              |
| a1f3533f96 |            | 82         |              |               |              |
| 95         |            |            |              |               |              |
+------------+------------+------------+--------------+---------------+--------------+

# इंस्टेंस चल रहा है जो Heat टेम्पलेट से बनाया गया है

root@dlp ~(keystone)#
openstack server list

+--------------+--------------+--------+---------------+------------+----------+
| ID           | Name         | Status | Networks      | Image      | Flavor   |
+--------------+--------------+--------+---------------+------------+----------+
| 2f4a92be-    | Heat_Deploye | ACTIVE | private=192.1 | Ubuntu2404 | m1.small |
| 2734-42b1-   | d_Server     |        | 68.100.81     |            |          |
| ba4e-        |              |        |               |            |          |
| ac92aa628e04 |              |        |               |            |          |
+--------------+--------------+--------+---------------+------------+----------+

# उदाहरण हटाएँ

root@dlp ~(keystone)#
openstack stack delete --yes Sample-Stack

root@dlp ~(keystone)#
openstack stack list


[2]
लेखन टेम्पलेट के लिए मार्गदर्शिका नीचे आधिकारिक साइट पर खोली गई है।
⇒ https://docs.openstack.org/heat/latest/template_guide/index.html
[3] यदि आप किसी सामान्य उपयोगकर्ता के साथ हीट का उपयोग करना चाहते हैं, तो उसे उपयोगकर्ता को Heat भूमिका में जोड़ना होगा।
root@dlp ~(keystone)#
openstack role list

+----------------------------------+------------------+
| ID                               | Name             |
+----------------------------------+------------------+
| 434c72643a134d18afd1d12094cfc75d | service          |
| 5afd228854f24746b11c26350784938a | heat_stack_owner |
| a15f53c1498a442281b01059ff6c9e0f | heat_stack_user  |
| b5c98a36bb6e4258a76a76bc96727fac | reader           |
| d7e77a716fd34ac2b6e8a91c19d5d91d | member           |
| d8f785820bf545f897e1fb2f35adefca | manager          |
| eccdad43835c44ad80be889f658236f3 | admin            |
+----------------------------------+------------------+

root@dlp ~(keystone)#
openstack project list

+----------------------------------+-----------+
| ID                               | Name      |
+----------------------------------+-----------+
| 18ede7365bdc430093e8fd4a90f77369 | hiroshima |
| 9c5145f76fd84324bdd2b1b61658a282 | admin     |
| ab9749e59bdb48e4807a18abb83c9f99 | service   |
+----------------------------------+-----------+

root@dlp ~(keystone)#
openstack user list

+----------------------------------+-------------------+
| ID                               | Name              |
+----------------------------------+-------------------+
| 3293956ed49545e7b8b45fffa0335e24 | admin             |
| ef82743092ad4032a6c9cbd1c655dab6 | glance            |
| 615a0611270e4887935501977ff7dff0 | nova              |
| bf7932c4546a46f89b7133ff11c591c3 | placement         |
| e83aa70b68ba43528e48067d60c20a4b | neutron           |
| b9371d015e0d43dca74f29161448ffd2 | serverworld       |
| 4def6f94581c43a3b2627416608a42b9 | cinder            |
| 089ecbb2dcaa421aa549bd8efb9f03f2 | heat              |
| cf935777627845dead14b4a5d7576f3a | heat_domain_admin |
+----------------------------------+-------------------+

# उदाहरण के लिए, [hirosima] प्रोजेक्ट में [serverworld] उपयोगकर्ता को [heat_stack_owner] भूमिका में जोड़ें

root@dlp ~(keystone)#
openstack role add --project hiroshima --user serverworld heat_stack_owner
# यह ठीक है, आम उपयोगकर्ता स्टैक बना सकते हैं

ubuntu@dlp ~(keystone)$
openstack stack list

+---------------+--------------+---------------+----------------+--------------+
| ID            | Stack Name   | Stack Status  | Creation Time  | Updated Time |
+---------------+--------------+---------------+----------------+--------------+
| abe4d9a2-     | Sample-Stack | CREATE_COMPLE | 2024-05-       | None         |
| 547e-464e-    |              | TE            | 22T01:46:14Z   |              |
| b688-         |              |               |                |              |
| 4d800475143d  |              |               |                |              |
+---------------+--------------+---------------+----------------+--------------+

ubuntu@dlp ~(keystone)$
openstack server list

+--------------+--------------+---------+--------------+------------+----------+
| ID           | Name         | Status  | Networks     | Image      | Flavor   |
+--------------+--------------+---------+--------------+------------+----------+
| 4b9c9101-    | Heat_Deploye | ACTIVE  | private=192. | Ubuntu2404 | m1.small |
| 2c33-4eea-   | d_Server     |         | 168.100.195  |            |          |
| 9184-        |              |         |              |            |          |
| 25fbe0ebff88 |              |         |              |            |          |
| 7fbc24c1-    | Ubuntu-2404  | SHUTOFF | private=10.0 | Ubuntu2404 | m1.small |
| c0d1-43d6-   |              |         | .0.208, 192. |            |          |
| 87aa-        |              |         | 168.100.130  |            |          |
| 68df83597b57 |              |         |              |            |          |
+--------------+--------------+---------+--------------+------------+----------+
मिलान सामग्री