一、创建heat相关数据库、服务凭证和API端点
1、创建数据库
mysql -p123
MariaDB [(none)]> CREATE DATABASE heat;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' IDENTIFIED BY 'heat123';
我这里设置密码为heat123
MariaDB [(none)]> exit
2、获取凭据以获取对仅限管理员的 CLI 命令的访问权限:admin
. admin-openrc
3、创建服务凭据
创建heat
用户:
openstack user create --domain default --password=heat123 heat
添加 admin 角色到 heat 用户上
openstack role add --project service --user heat admin
这个命令执行后没有输出。
创建heat
和 heat-cfn 服务实体:
openstack service create --name heat --description "Orchestration" orchestration
openstack service create --name heat-cfn --description "Orchestration" cloudformation
4、创建 Orchestration 服务的 API 端点
openstack endpoint create --region RegionOne orchestration public http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne orchestration internal http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne orchestration admin http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne cloudformation public http://controller:8000/v1
openstack endpoint create --region RegionOne cloudformation internal http://controller:8000/v1
openstack endpoint create --region RegionOne cloudformation admin http://controller:8000/v1
5、业务流程需要标识服务中的其他信息来管理堆栈。
1.为栈创建 heat 包含项目和用户的域:
openstack domain create --description "Stack projects and users" heat
2.在 heat 域中创建管理项目和用户的heat_domain_admin
用户:
openstack user create --domain heat --password=heat123 heat_domain_admin
我这里设置密码为heat123
3.添加admin
角色到 heat 域 中的heat_domain_admin
用户,启用heat_domain_admin
用户管理栈的管理权限
openstack role add --domain heat --user-domain heat --user heat_domain_admin admin
这个命令执行后没有输出。
4.创建 heat_stack_owner 角色:
openstack role add --project demo --user demo heat_stack_owner
5.添加heat_stack_owner
角色到demo
项目和用户,启用demo
用户管理栈。
openstack role add --project demo --user demo heat_stack_owner
这个命令执行后没有输出。 必须添加 heat_stack_owner 角色到每个管理栈的用户。
注意: 在部署keystone时有会有两个管理用户,一个是admin,一个是demo,这时你报错显示没有demo用,说明当时部署时没有创建demo,这里将demo换成admin已有的用户即可
6.创建 heat_stack_user 角色
openstack role create heat_stack_user
二、安装并配置Heat组件
1、安装软件包
yum install openstack-heat-api openstack-heat-api-cfn openstack-heat-engine -y
2.修改heat配置
编辑/etc/heat/heat.conf
[database]
connection = mysql+pymysql://heat:heat123@controller/heat
#密码以自己的为准
[DEFAULT]
transport_url = rabbit://openstack:openstack@controller
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = heat
password = heat123
[trustee]
auth_type = password
auth_url = http://controller:5000
username = heat
password = heat123
user_domain_name = default
[clients_keystone]
auth_uri = http://controller:5000
[DEFAULT]
heat_metadata_server_url = http://controller:8000
heat_waitcondition_server_url = http://controller:8000/v1/waitcondition
[DEFAULT]
stack_domain_admin = heat_domain_admin
stack_domain_admin_password = heat123
stack_user_domain_name = heat
3、同步Orchestration数据库
su -s /bin/sh -c "heat-manage db_sync" heat
三、启动 Orchestration 编排服务heat组件并将其设置为随系统启动
systemctl enable openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service
systemctl restart openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service
systemctl list-unit-files |grep openstack-heat*
四、验证操作
1.获取租户凭据:admin
. admin-openrc
2.列出服务组件以验证每个进程的成功启动和注册
[root@controller ~]# openstack orchestration service list
+------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+
| Hostname | Binary | Engine ID | Host | Topic | Updated At | Status |
+------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+
| controller | heat-engine | 63d58fb8-9bc6-41da-bbe5-7c9f4be22d49 | controller | engine | 2022-06-08T04:18:49.000000 | up |
| controller | heat-engine | fb6116bf-6491-4860-a44f-ed75cb36fc0e | controller | engine | 2022-06-08T04:18:49.000000 | up |
| controller | heat-engine | d19aee2f-37d2-41c8-9fd2-0a27effda7c5 | controller | engine | 2022-06-08T04:18:49.000000 | up |
| controller | heat-engine | 7f87f753-d36a-4ffe-ae6f-995b73b0f341 | controller | engine | 2022-06-08T04:18:49.000000 | up |
+------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+
3.列出服务组件,以验证是否成功启动并注册了每个进程:
[root@controller ~]# openstack service list
+----------------------------------+-----------+----------------+
| ID | Name | Type |
+----------------------------------+-----------+----------------+
| 436b9fb83d73411bbd0de0af26793447 | swift | object-store |
| 43b9a0f6f37a46d283f4894f2d0d3c65 | neutron | network |
| 4c67912c0eb742ba873bd819694beacf | heat | orchestration |
| 64e97bc968b64eddadd1084db20d6caf | cinderv3 | volumev3 |
| 8932f09b4cc64b6a9f0790670ce5cf49 | cinderv2 | volumev2 |
| a5a24a194c624065baf138396d926bae | placement | placement |
| af7b4b11073540609d2f5bb206175a31 | nova | compute |
| bad3eb2063a54c9fa96b5da0ba3fe994 | glance | image |
| bc03beecbf4e421f9b2c44f88f7cca8b | keystone | identity |
| fc0e9a37158d4185b218e9d271f6a329 | heat-cfn | cloudformation |
+----------------------------------+-----------+----------------+
[root@controller ~]# ps aux | grep heat
heat 33217 2.4 2.0 472976 78184 ? Ss 12:18 0:03 /usr/bin/python2 /usr/bin/heat-api --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat 33218 2.3 1.9 472092 77176 ? Ss 12:18 0:03 /usr/bin/python2 /usr/bin/heat-api-cfn --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat 33219 6.5 2.8 508492 109764 ? Ss 12:18 0:10 /usr/bin/python2 /usr/bin/heat-engine --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat 33259 0.0 2.0 472976 77884 ? S 12:18 0:00 /usr/bin/python2 /usr/bin/heat-api --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat 33260 0.0 2.0 472976 77888 ? S 12:18 0:00 /usr/bin/python2 /usr/bin/heat-api --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat 33261 1.1 2.1 475108 81344 ? S 12:18 0:01 /usr/bin/python2 /usr/bin/heat-api --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat 33262 0.0 2.0 472976 77900 ? S 12:18 0:00 /usr/bin/python2 /usr/bin/heat-api --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat 33268 1.3 3.0 514536 116164 ? S 12:18 0:02 /usr/bin/python2 /usr/bin/heat-engine --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat 33269 0.5 3.0 514552 116112 ? S 12:18 0:00 /usr/bin/python2 /usr/bin/heat-engine --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat 33270 0.4 2.9 514156 115332 ? S 12:18 0:00 /usr/bin/python2 /usr/bin/heat-engine --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat 33271 0.4 2.9 514168 115328 ? S 12:18 0:00 /usr/bin/python2 /usr/bin/heat-engine --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
root 33608 0.0 0.0 112728 964 pts/0 S+ 12:21 0:00 grep --color=auto heat
[root@controller ~]# ps -A | grep heat
33217 ? 00:00:03 heat-api
33218 ? 00:00:03 heat-api-cfn
33219 ? 00:00:10 heat-engine
33259 ? 00:00:00 heat-api
33260 ? 00:00:00 heat-api
33261 ? 00:00:01 heat-api
33262 ? 00:00:00 heat-api
33268 ? 00:00:02 heat-engine
33269 ? 00:00:00 heat-engine
33270 ? 00:00:00 heat-engine
33271 ? 00:00:00 heat-engine
[root@controller ~]# netstat -ltunp | grep 8000
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 33218/python2
[root@controller ~]# netstat -ltunp | grep 8004
tcp 0 0 0.0.0.0:8004 0.0.0.0:* LISTEN 33217/python2
验证成功即可!