[Openstack 설치 글]
[CLOUD/OpenStack] - Openstack-Victoria설치(사전작업)
[CLOUD/OpenStack] - [Victoria] Keystone 설치
[CLOUD/OpenStack] - [Victoria] Glance 설치
[CLOUD/OpenStack] - [Victoria] Nova 설치
[CLOUD/OpenStack] - [Victoria] Horizon 설치
1. Nova 데이터 베이스 설정하기(Controller서버에서 진행)
nova, nova_api, nova_cell0 데이터베이스 생성
nova_cell0 데이터 베이스는 nova-api, nova-conductor, nova-compute 서비스에 의해 사용되며 스케줄링에 실패한 인스턴스의 정보를 저장합니다.
placement의 경우, 인스턴스 생성에 필요한 자원과 나머지 자원 그리고 전체 사용량에 대한 정보를 저장하기 위해 사용됩니다.
MariaDB [(none)]> create database nova;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> grant all privileges on nova.* to nova@'localhost' identified by 'NOVA_DBPASS';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> grant all privileges on nova.* to nova@'%' identified by 'NOVA_DBPASS';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> create database nova_api;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> grant all privileges on nova_api.* to nova@'localhost' identified by 'NOVA_DBPASS';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> grant all privileges on nova_api.* to nova@'%' identified by 'NOVA_DBPASS';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> create database nova_cell0;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> grant all privileges on nova_cell0.* to nova@'localhost' identified by 'NOVA_DBPASS';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> grant all privileges on nova_cell0.* to nova@'%' identified by 'NOVA_DBPASS';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> create database placement;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> grant all privileges on placement.* to placement@'localhost' identified by 'PLACEMENT_DBPASS';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> grant all privileges on placement.* to placement@'%' identified by 'PLACEMENT_DBPASS';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)
2. Nova 사용자, 서비스, 엔드포인트 생성하기(Controller서버에서 진행)
admin 환경으로 변경
root@controller:~# source admin-openrc
nova 사용자 생성 및 role 추가
root@controller:~# openstack user create --domain default --project service --password NOVA_PASS nova
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| default_project_id | 403d041d31534b329c8dfc73a0c2584b |
| domain_id | default |
| enabled | True |
| id | ced68f3d622d476daeb1dc0f0c62da46 |
| name | nova |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
root@controller:~# openstack role add --project service --user nova admin
placement 사용자 생성 및 role 추가
root@controller:~# openstack user create --domain default --project service --password PLACEMENT_PASS placement
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
|default_project_id | 403d041d31534b329c8dfc73a0c2584b |
| domain_id | default |
| enabled | True |
| id | 8047905fefb24cb483f2460483d2aee1 |
| name | placement |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
root@controller:~# openstack role add --project service --user placement admin
nova, placement 서비스 생성
root@controller:~# openstack service create --name nova --description "OpenStack Compute service" compute
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute service |
| enabled | True |
| id | 50c66234229d452987318b4a18aa33ce |
| name | nova |
| type | compute |
+-------------+----------------------------------+
root@controller:~# openstack service create --name placement --description "Openstack Compute Placement service" placement
+-------------+-------------------------------------+
| Field | Value |
+-------------+-------------------------------------+
| description | Openstack Compute Placement service |
| enabled | True |
| id | fa992cab28b14a58a6f5ede015a9136c |
| name | placement |
| type | placement |
+-------------+-------------------------------------+
nova, placement endpoint 생성
root@controller:~# openstack endpoint create --region Region01 compute public http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 5e8d8dd8226f4f46a6d70231611d0cf8 |
| interface | public |
| region | Region01 |
| region_id | Region01 |
| service_id | 50c66234229d452987318b4a18aa33ce |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
root@controller:~# openstack endpoint create --region Region01 compute internal http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 71d5e7544a9e43d1a013643777d69c45 |
| interface | internal |
| region | Region01 |
| region_id | Region01 |
| service_id | 50c66234229d452987318b4a18aa33ce |
| service_name | nova | | service_type | compute |
| url | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
root@controller:~# openstack endpoint create --region Region01 compute admin http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 9bac9331dbaf43f4add199e3378e37cc |
| interface | admin |
| region | Region01 | | region_id | Region01 |
| service_id | 50c66234229d452987318b4a18aa33ce |
| service_name | nova |
| service_type | compute |
| url | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
root@controller:~# openstack endpoint create --region Region01 placement public http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | c7aaad7353394c948c0785d60a002d7e |
| interface | public |
| region | Region01 |
| region_id | Region01 |
| service_id | fa992cab28b14a58a6f5ede015a9136c |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
root@controller:~# openstack endpoint create --region Region01 placement internal http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | a605ca086ff14184825c463d80fe4cd7 |
| interface | internal |
| region | Region01 |
| region_id | Region01 |
| service_id | fa992cab28b14a58a6f5ede015a9136c |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
root@controller:~# openstack endpoint create --region Region01 placement admin http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | be957bd864774592a3f61bbebdf46992 |
| interface | admin |
| region | Region01 |
| region_id | Region01 |
| service_id | fa992cab28b14a58a6f5ede015a9136c |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
root@controller:~# apt-get -y install nova-api nova-conductor nova-scheduler nova-novncproxy placement-api python3-novaclient
root@controller:~# cat /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:rabbit_pass@controller
my_ip = 192.168.198.100
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api
[database]
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_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 = nova
password = NOVA_PASS
[vnc]
enabled = true
vncserver_listen = 192.168.198.100
vncserver_proxyclient_address = 192.168.198.100
[glance]
api_servers = http://controller:9292
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[placement]
os_region_name = Region01
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = PLACEMENT_PASS
[wsgi]
api_paste_config = /etc/nova/api-paste.ini
Nova.conf 파일 내용 설명
root@controller:~# chmod 640 /etc/nova/nova.conf
root@controller:~# chgrp nova /etc/nova/nova.conf
root@controller:~# cat /etc/placement/placement.conf
[DEFAULT]
debug = false
[api]
auth_strategy = keystone
[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 = placement
password = PLACEMENT_PASS
[placement_database]
connection = mysql+pymysql://placement:PLACEMENT_DBPASS@controller/placement
root@controller:~# chmod 640 /etc/placement/placement.conf
root@controller:~# chgrp placement /etc/placement/placement.conf
4. 데이터베이스 추가
root@controller:~# su -s /bin/bash placement -c "placement-manage db sync"
root@controller:~# su -s /bin/bash nova -c "nova-manage api_db sync"
root@controller:~# su -s /bin/bash nova -c "nova-manage cell_v2 map_cell0"
root@controller:~# su -s /bin/bash nova -c "nova-manage db sync"
root@controller:~# su -s /bin/bash nova -c "nova-manage cell_v2 create_cell --name cell0"
5. 서비스 재시작
root@controller:~# systemctl restart apache2
root@controller:~# for service in api conductor scheduler novncproxy;do
> systemctl restart nova-$service
> done
root@controller:~# openstack compute service list
+----+----------------+------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+----------------+------------+----------+---------+-------+----------------------------+
| 5 | nova-conductor | controller | internal | enabled | up | 2021-05-03T09:25:08.000000 |
| 9 | nova-scheduler | controller | internal | enabled | up | None |
+----+----------------+------------+----------+---------+-------+----------------------------+
6. 방화벽
tcp/6080 포트 열어줍니다. (nova-novncproxy)
tcp/8774 포트 열어줍니다. (nova-api)
tcp/8775 포트 열어줍니다. (nova-metadata)
tcp/8778 포트 열어줍니다. (nova-placement-api)
root@compute:~# apt-get install nova-compute nova-compute-kvm
root@compute:~# cat /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:RABBIT_PASS@controller
my_ip = 192.168.198.102
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_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 = nova
password = NOVA_PASS
[vnc]
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = 192.168.198.102
novncproxy_base_url = http://controller:6080/vnc_auto.html
[glance]
api_servers = http://controller:9292
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[placement]
os_region_name = Region01
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = PLACEMENT_PASS
3. Nova 서비스 시작
가상화 모듈이 지원이 가능한지 확인
root@compute:~# lsmod | grep kvm
kvm_intel 282624 9
kvm 663552 1 kvm_intel
root@compute:~# systemctl restart nova-compute libvirtd
※Controller 서버에서 compute 노드 확인
root@controller:~# su -s /bin/bash nova -c "nova-manage cell_v2 discover_hosts"
root@controller:~# openstack compute service list
+----+----------------+------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+----------------+------------+----------+---------+-------+----------------------------+
| 5 | nova-conductor | controller | internal | enabled | up | 2021-05-03T09:41:18.000000 |
| 9 | nova-scheduler | controller | internal | enabled | up | 2021-05-03T09:41:21.000000 |
| 13 | nova-compute | compute | nova | enabled | up | 2021-05-03T09:41:16.000000 |
+----+----------------+------------+----------+---------+-------+----------------------------+
새로운 compute 노드를 추가할 때, 새로운 compute 노드들의 등록을 위해 controller 서버에서 nova-manage cell_v2 discover_hosts를 꼭 실행해야 합니다. 또는 /etc/nova/nova.conf 에서 적절한 interval을 설정할 수 있습니다
# vi /etc/nova/nova.conf
[scheduler]
discover_hosts_in_cells_interval = 300
'OpenStack' 카테고리의 다른 글
ovs-vsctl annot load glue library: libibverbs.so.1 에러메시지 (0) | 2021.02.11 |
---|---|
[Victoria] Horizon 설치 (0) | 2020.10.12 |
[정리] Nova 이론 (0) | 2020.10.04 |
[Victoria] Glance 설치 (0) | 2020.09.20 |
[정리] Glance 이론 (0) | 2020.09.20 |