OpenStack Epoxy : How to use Heat |
How to use the OpenStack Orchestration Service (Heat). This example is based on the environment like follows. ------------+--------------------------+--------------------------+------------
| | |
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 |
| | | Heat API/Engine | | |
+-----------------------+ +-----------------------+ +-----------------------+
|
| [1] | Deploy Instances with Heat services and templates. The example below is on the Control Node. |
root@dlp ~(keystone)# apt -y install python3-heatclient 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 | +--------------------------------------+----------+--------+ | 33def798-3361-483b-9de1-8c2c6e1c840c | Debian13 | active | +--------------------------------------+----------+--------+root@dlp ~(keystone)# openstack network list +---------------------------------+---------+----------------------------------+ | ID | Name | Subnets | +---------------------------------+---------+----------------------------------+ | 7de3878f-814f-4909-b4e6- | public | 319013fd-5412-4cce- | | d4dc1c740577 | | bb87-49f5a0c91b0e | | d442015a-b6f6-4349-890b- | private | bb5efd0a-ea4d-42ee-99ca- | | c08eb5366a4d | | 97cee2f56ca2 | +---------------------------------+---------+----------------------------------+root@dlp ~(keystone)# Int_Net_ID=$(openstack network list | grep private | awk '{ print $2 }') # create an instance from the template root@dlp ~(keystone)# openstack stack create -t sample-stack.yml --parameter "ImageID=Debian13;NetID=$Int_Net_ID" Sample-Stack +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | id | 7f5e1e34-f28d-4ce7-9fc5-8250114a805a | | stack_name | Sample-Stack | | description | Heat Sample Template | | creation_time | 2025-09-01T01:16:40Z | | updated_time | None | | stack_status | CREATE_IN_PROGRESS | | stack_status_reason | Stack CREATE started | +---------------------+--------------------------------------+ # turn to [CREATE_COMPLETE] after few minutes later like follows root@dlp ~(keystone)# openstack stack list +------------+------------+------------+--------------+---------------+--------------+ | ID | Stack Name | Project | Stack Status | Creation Time | Updated Time | +------------+------------+------------+--------------+---------------+--------------+ | 7f5e1e34- | Sample- | d5ba291bfc | CREATE_COMPL | 2025-09- | None | | f28d-4ce7- | Stack | dc4f8982cf | ETE | 01T01:16:40Z | | | 9fc5- | | 5c28922f56 | | | | | 8250114a80 | | be | | | | | 5a | | | | | | +------------+------------+------------+--------------+---------------+--------------+ # the instance is running which is created from the Heat template root@dlp ~(keystone)# openstack server list +---------------+---------------+--------+---------------+----------+----------+ | ID | Name | Status | Networks | Image | Flavor | +---------------+---------------+--------+---------------+----------+----------+ | 738de48a- | Heat_Deployed | ACTIVE | private=192.1 | Debian13 | m1.small | | 8d1c-4d7b- | _Server | | 68.100.205 | | | | 85db- | | | | | | | 135ac4bb7839 | | | | | | +---------------+---------------+--------+---------------+----------+----------+ # delete the instance root@dlp ~(keystone)# openstack stack delete --yes Sample-Stack root@dlp ~(keystone)# openstack stack list |
| [2] | The guide for writing templates are opened on the official site below. |
| [3] | If you'd like to use Heat with a common user, it needs to add the user in Heat role. |
| root@dlp ~(keystone)# openstack role list +----------------------------------+------------------+ | ID | Name | +----------------------------------+------------------+ | 07ce3758f5024ba0b7e4fbc7d6c959fb | heat_stack_user | | 63cc6311337942cba639d3d3bf1d35d6 | admin | | 7cbfe543966541bb96bab7b0a76c6000 | reader | | 9df2c32143a44aadb6283d14ba8c388b | service | | c821194726504d8cbc480d8f993cb22b | heat_stack_owner | | d6cf0ee3aae54ce6bb026111e899b038 | member | | e551847f4a3343c096000cfd33428239 | manager | +----------------------------------+------------------+root@dlp ~(keystone)# openstack project list +----------------------------------+-----------+ | ID | Name | +----------------------------------+-----------+ | a60814a6c56241edbbdfae6c290f8abc | service | | d5ba291bfcdc4f8982cf5c28922f56be | admin | | ecfa98ba82de421e8f16c3d862b5ab04 | hiroshima | +----------------------------------+-----------+root@dlp ~(keystone)# openstack user list +----------------------------------+-------------------+ | ID | Name | +----------------------------------+-------------------+ | 0210304ac2d64018aab08e48ffb1ce86 | heat | | 06049893e44749959c53ee1f72bc99ff | neutron | | 214a5c278c4348ae9cba95793b764890 | placement | | 69f2622e80f44396b403728eaefa32ff | nova | | 7df36a951e6b4e3eaa53f3c0c5c70f23 | glance | | 95daf16948b542368c68ab90031c0775 | admin | | c3474318d91a472a88255bac043cff44 | cinder | | c54e603aa0164242a697ba1af3b18c45 | heat_domain_admin | | da64c3c335434563b66eb2e8af260392 | serverworld | +----------------------------------+-------------------+ # for example, add [serverworld] user in [hiroshima] project to [heat_stack_owner] role root@dlp ~(keystone)# openstack role add --project hiroshima --user serverworld heat_stack_owner # that's OK, common users can create stacks debian@dlp ~(keystone)$ openstack stack list +---------------+--------------+---------------+----------------+--------------+ | ID | Stack Name | Stack Status | Creation Time | Updated Time | +---------------+--------------+---------------+----------------+--------------+ | 51466a67- | Sample-Stack | CREATE_COMPLE | 2025-09- | None | | 27dd-4c72- | | TE | 01T01:20:15Z | | | 9bf2- | | | | | | 0073027dc632 | | | | | +---------------+--------------+---------------+----------------+--------------+debian@dlp ~(keystone)$ openstack server list +--------------+--------------+---------+----------------+----------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------+--------------+---------+----------------+----------+----------+ | a2c7d84e- | Heat_Deploye | ACTIVE | private=192.16 | Debian13 | m1.small | | a9c0-4b05- | d_Server | | 8.100.140 | | | | bf89- | | | | | | | 15bcce217890 | | | | | | | 2deabceb- | Debian-13 | SHUTOFF | private=10.0.0 | Debian13 | m1.small | | e220-4e5c- | | | .249, | | | | b8dd- | | | 192.168.100.39 | | | | 320683d0bf0b | | | | | | +--------------+--------------+---------+----------------+----------+----------+ |
Matched Content
No comments:
Post a Comment