구축/Openstack

openstack 구축 5 nova

KidAnt 2024. 1. 3. 11:15


  • 노바는 컴퓨팅 부분 그러니까 VM의 관리를 맡는 서비스이다.
  • 여기서부터 openstack 공식 메뉴얼에 오탈자 부분이 있어 만일 공식 메뉴얼을 참고할 경우 유심히 확인하여 설치하는게 좋다.
  • 단일 노드일경우는 추가적으로 기입하는 형태로 진행하면 되어서 상관없지만 다중 노드일경우 컨트롤러 노드와 컴퓨팅 노드 부분을 유의하여 구축하길 바란다.

컨트롤러 노드

DB, 서비스 사용자 등록 및 API 엔드포인트 생성

sudo su root
#루트 권한 접속

#DB 등록
mysql
#mariadb 접속

MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
#DB생성

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
  IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
  IDENTIFIED BY 'NOVA_DBPASS';

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
  IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
  IDENTIFIED BY 'NOVA_DBPASS';

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \
  IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \
  IDENTIFIED BY 'NOVA_DBPASS';
#액세스 권한 설정,설정한 NOVA_DBPASS 기입

. admin-openrc
#어드민 권한 접속

#서비스 사용자 등록
openstack user create --domain default --password-prompt nova
#nova 사용자 등록

User Password: #NOVA_PASS
Repeat User Password: #NOVA_PASS
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 8a7dbf5279404537b1c7b86c033620fe |
| name                | nova                             |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
#생성 결과(예시)

openstack role add --project service --user nova admin
#admin 역활 추가

openstack service create --name nova \
--description "OpenStack Compute" compute
#서비스 엔터티 생성

#API 엔드포인트 추가
openstack endpoint create --region RegionOne \
compute public http://controller:8774/v2.1
#public

+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | 3c1caa473bfe4390a11e7177894bcc7b          |
| interface    | public                                    |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 060d59eac51b4594815603d75a00aba2          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1               |
+--------------+-------------------------------------------+
#생성 결과(예시)

openstack endpoint create --region RegionOne \
compute internal http://controller:8774/v2.1
#internal

+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | e3c918de680746a586eac1f2d9bc10ab          |
| interface    | internal                                  |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 060d59eac51b4594815603d75a00aba2          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1               |
+--------------+-------------------------------------------+
#생성 결과(예시)

openstack endpoint create --region RegionOne \
compute admin http://controller:8774/v2.1
#admin

+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | 38f7af91666a47cfb97b4dc790b94424          |
| interface    | admin                                     |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | 060d59eac51b4594815603d75a00aba2          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1               |
+--------------+-------------------------------------------+
#생성 결과(예시)

구성요소 설치 및 설정

apt-get update
#최신화

apt install nova-api nova-conductor nova-novncproxy nova-scheduler
#패키지 설치

vi /etc/nova/nova.conf
[api_database]
....(생략)
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api
#NOVA_DBPASS 기입

[database]
....(생략)
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova
#NOVA_DBPASS 기입

[DEFAULT]
#log_dir = /var/log/nova
#패키징 버그로 인하여 'log_dir'이 활성화 되어 있다면 '#'을 붙혀 비활성화
....(생략)
transport_url = rabbit://openstack:RABBIT_PASS@controller:5672/
#RABBIT_PASS 기입

[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 = nova
password = NOVA_PASS
#NOVA_PASS 기입

[service_user]

send_service_user_token = true
auth_url = http://controller:5000/identity
auth_strategy = keystone
auth_type = password
project_domain_name = Default
project_name = service
user_domain_name = Default
username = nova
password = NOVA_PASS
#공식 메뉴얼에서는 'auth_url'에서 'http://' 가 아닌 'https://' 로 되어있고
#keystone의 5000포트가 빠져있어
#이 부분을 수정하지 않으면 서비스 토큰이 정상 발급되지않아 서비스가 정상적으로 돌지 않는다.
#NOVA_PASS 기입

[DEFAULT]
...(생략)
my_ip = controller
#해당 부분은 설정파일의 변수로 사용하기 때문에 controller의 로컬 ip로 기입하는 걸 권장한다.

[vnc]
...(생략)
enabled = true
...(생략)
server_listen = $my_ip
...(생략)
server_proxyclient_address = $my_ip

[glance]
...(생략)
api_servers = http://controller:9292

[oslo_concurrency]
...(생략)
lock_path = /var/lib/nova/tmp

[placement]

region_name = RegionOne
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
#PLACEMENT_PASS 기입

wq
#저장

su -s /bin/sh -c "nova-manage api_db sync" nova
#nova-api DB에 설정값 기입

su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
#'cell0' DB 등록

su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
#'cell1'셀 생성

su -s /bin/sh -c "nova-manage db sync" nova
#nova DB에 설정값 기입

su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
#등록확인

+-------+--------------------------------------+----------------------------------------------------+--------------------------------------------------------------+----------+
|  Name |                 UUID                 |                   Transport URL                    |                     Database Connection                      | Disabled |
+-------+--------------------------------------+----------------------------------------------------+--------------------------------------------------------------+----------+
| cell0 | 00000000-0000-0000-0000-000000000000 |                       none:/                       | mysql+pymysql://nova:****@controller/nova_cell0?charset=utf8 |  False   |
| cell1 | f690f4fd-2bc5-4f15-8145-db561a7b9d3d | rabbit://openstack:****@controller:5672/nova_cell1 | mysql+pymysql://nova:****@controller/nova_cell1?charset=utf8 |  False   |
+-------+--------------------------------------+----------------------------------------------------+--------------------------------------------------------------+----------+
#생성 결과(예시)

#설치 마무리를 위한 각 nova 재시작
service nova-api restart
service nova-scheduler restart
service nova-conductor restart
service nova-novncproxy restart

컴퓨팅 노드

구성 요소 설치 및 구성

apt-get update
#최신화

apt install nova-compute
#패키지 설치

[DEFAULT]
my_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
#컴퓨팅 노드의 ip
...(생략)
transport_url = rabbit://openstack:RABBIT_PASS@controller:5672/

[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 = nova
password = NOVA_PASS

[service_user]
send_service_user_token = true
auth_url = http://controller:5000/identity
auth_strategy = keystone
auth_type = password
project_domain_name = Default
project_name = service
user_domain_name = Default
username = nova
password = NOVA_PASS

[vnc]
enabled = true
server_listen = $my_ip #컴퓨팅 노드일경우 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html

[glance]
...(생략)
api_servers = http://controller:9292

[oslo_concurrency]
...(생략)
lock_path = /var/lib/nova/tmp

[placement]

region_name = RegionOne
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
#PLACEMENT_PASS 기입

wq
#저장

#설치 마무리
service nova-compute restart
#재시작

셀 데이터베이스에 컴퓨팅 노드 추가 (컨트롤러 노드에서 진행)

. admin-openrc
#어드민 권한 접속

openstack compute service list --service nova-compute
#컴퓨팅 노드 확인
+----+-------+--------------+------+-------+---------+----------------------------+
| ID | Host  | Binary       | Zone | State | Status  | Updated At                 |
+----+-------+--------------+------+-------+---------+----------------------------+
| 1  | node1 | nova-compute | nova | up    | enabled | 2017-04-14T15:30:44.000000 |
+----+-------+--------------+------+-------+---------+----------------------------+
#출력값(예시)

su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
#컴퓨팅 호스트 검색

Found 2 cell mappings.
Skipping cell0 since it does not contain hosts.
Getting compute nodes from cell 'cell1': ad5a5985-a719-4567-98d8-8d148aaae4bc
Found 1 computes in cell: ad5a5985-a719-4567-98d8-8d148aaae4bc
Checking host mapping for compute host 'compute': fe58ddc1-1d65-4f87-9456-bc040dc106b3
Creating host mapping for compute host 'compute': fe58ddc1-1d65-4f87-9456-bc040dc106b3
#출력값(예시)

작동 확인 (컨트롤러 노드)

노드 작동 확인

. admin-openrc
#어드민 권한 흭득

openstack compute service list
#서비스 구성요소 나열
+----+--------------------+------------+----------+---------+-------+----------------------------+
| Id | Binary             | Host       | Zone     | Status  | State | Updated At                 |
+----+--------------------+------------+----------+---------+-------+----------------------------+
|  1 | nova-scheduler     | controller | internal | enabled | up    | 2016-02-09T23:11:15.000000 |
|  2 | nova-conductor     | controller | internal | enabled | up    | 2016-02-09T23:11:16.000000 |
|  3 | nova-compute       | compute1   | nova     | enabled | up    | 2016-02-09T23:11:20.000000 |
+----+--------------------+------------+----------+---------+-------+----------------------------+
#결과값(예시)
#해당 State 부분이 up 상태여야 한다.

openstack catalog list
#연결 확인을 위한 엔드포인트 나열

+-----------+-----------+-----------------------------------------+
| Name      | Type      | Endpoints                               |
+-----------+-----------+-----------------------------------------+
| keystone  | identity  | RegionOne                               |
|           |           |   public: http://controller:5000/v3/    |
|           |           | RegionOne                               |
|           |           |   internal: http://controller:5000/v3/  |
|           |           | RegionOne                               |
|           |           |   admin: http://controller:5000/v3/     |
|           |           |                                         |
| glance    | image     | RegionOne                               |
|           |           |   admin: http://controller:9292         |
|           |           | RegionOne                               |
|           |           |   public: http://controller:9292        |
|           |           | RegionOne                               |
|           |           |   internal: http://controller:9292      |
|           |           |                                         |
| nova      | compute   | RegionOne                               |
|           |           |   admin: http://controller:8774/v2.1    |
|           |           | RegionOne                               |
|           |           |   internal: http://controller:8774/v2.1 |
|           |           | RegionOne                               |
|           |           |   public: http://controller:8774/v2.1   |
|           |           |                                         |
| placement | placement | RegionOne                               |
|           |           |   public: http://controller:8778        |
|           |           | RegionOne                               |
|           |           |   admin: http://controller:8778         |
|           |           | RegionOne                               |
|           |           |   internal: http://controller:8778      |
|           |           |                                         |
+-----------+-----------+-----------------------------------------+
#출력값(예시)
#해당 출력에서 나오는 추가적인 경고는 무시하여도 됩니다.

openstack image list
#이미지 나열
+--------------------------------------+-------------+-------------+
| ID                                   | Name        | Status      |
+--------------------------------------+-------------+-------------+
| 9a76d9f9-9620-4f2e-8c69-6c5691fae163 | cirros      | active      |
+--------------------------------------+-------------+-------------+
#출력값(예시)

nova-status upgrade check
#nova API 상태 확인

+--------------------------------------------------------------------+
| Upgrade Check Results                                              |
+--------------------------------------------------------------------+
| Check: Cells v2                                                    |
| Result: Success                                                    |
| Details: None                                                      |
+--------------------------------------------------------------------+
| Check: Placement API                                               |
| Result: Success                                                    |
| Details: None                                                      |
+--------------------------------------------------------------------+
| Check: Cinder API                                                  |
| Result: Success                                                    |
| Details: None                                                      |
+--------------------------------------------------------------------+
| Check: Policy Scope-based Defaults                                 |
| Result: Success                                                    |
| Details: None                                                      |
+--------------------------------------------------------------------+
| Check: Policy File JSON to YAML Migration                          |
| Result: Success                                                    |
| Details: None                                                      |
+--------------------------------------------------------------------+
| Check: Older than N-1 computes                                     |
| Result: Success                                                    |
| Details: None                                                      |
+--------------------------------------------------------------------+
#출력값(예시)
#Result 부분이 모두 Success여야하며 추가적으로 보이는 오류는 무시하여도 된다.

 

'구축 > Openstack' 카테고리의 다른 글

openstack 구축 7 horizon  (0) 2024.01.09
openstack 구축 6 neutron  (0) 2024.01.05
openstack 구축 4 placement  (0) 2023.12.28
openstack 구축 3 glance  (0) 2023.12.28
openstack 구축 2 keystone  (1) 2023.12.27