OpenStack Stein : Heat 利用方法2019/04/17 |
OpenStack Orchestration Service(Heat)の利用方法です。
当例では以下のような環境を例に Orchestration サービスを設定しています。
------------+---------------------------+---------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ Control Node ] | | [ Network Node ] | | [ Compute Node ] | | | | | | | | MariaDB RabbitMQ | | L2 Agent | | Libvirt | | Memcached httpd | | L3 Agent | | Nova Compute | | Keystone Glance | | Metadata Agent | | L2 Agent | | Nova API | | Cinder Volume | | | | Neutron Server | | Heat API | | | | Metadata Agent | | Heat Engine | | | | Cinder API | | | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] | 構築した Heat サービスとテンプレートを利用してインスタンスをデプロイします。 作業は、どこでもよいですが、当例ではコントロールノード上で行います。 |
heat_template_version: 2018-08-31 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 | +--------------------------------------+------------+--------+ | 7690a3c0-99f7-40fe-8cde-343824edc74a | Ubuntu1804 | active | +--------------------------------------+------------+--------+root@dlp ~(keystone)# openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 4ac44922-6ee9-4f99-9901-06cd69bcb64b | ext_net | 19f83d21-e41f-4e96-8da1-84bfba298fc7 | | 596c0921-5acb-42e1-8b44-ff549c30cded | int_net | d09f2fd8-07d9-4365-9e5b-5aeb471a1b72 | +--------------------------------------+---------+--------------------------------------+root@dlp ~(keystone)# Int_Net_ID=$(openstack network list | grep int_net | awk '{ print $2 }')
# サンプルテンプレートからインスタンス作成 root@dlp ~(keystone)# openstack stack create -t sample-stack.yml --parameter "ImageID=Ubuntu1804;NetID=$Int_Net_ID" Sample-Stack +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | id | 134694f6-0fd6-49b1-be90-848e229cc5b4 | | stack_name | Sample-Stack | | description | Heat Sample Template | | creation_time | 2019-04-17T07:41:14Z | | updated_time | None | | stack_status | CREATE_IN_PROGRESS | | stack_status_reason | Stack CREATE started | +---------------------+--------------------------------------+ # しばらく待つとステータスがコンプリートになる root@dlp ~(keystone)# openstack stack list +--------------------------------------+--------------+----------------------------------+-----------------+----------------------+--------------+ | ID | Stack Name | Project | Stack Status | Creation Time | Updated Time | +--------------------------------------+--------------+----------------------------------+-----------------+----------------------+--------------+ | 134694f6-0fd6-49b1-be90-848e229cc5b4 | Sample-Stack | e52584cf60234bc090c7d437b8ca7b62 | CREATE_COMPLETE | 2019-04-17T07:41:14Z | None | +--------------------------------------+--------------+----------------------------------+-----------------+----------------------+--------------+ # テンプレートで指定したインスタンスが起動している root@dlp ~(keystone)# openstack server list +--------------------------------------+----------------------+--------+-------------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+----------------------+--------+-------------------------+------------+----------+ | 53f577a8-4c84-45ac-8bc0-1688435e6dc0 | Heat_Deployed_Server | ACTIVE | int_net=192.168.100.125 | Ubuntu1804 | m1.small | +--------------------------------------+----------------------+--------+-------------------------+------------+----------+ # 作成したものを削除する 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 |
Sponsored Link |