YUMSERV
Published 2020. 9. 20. 17:07
[Victoria] Glance 설치 OpenStack
반응형
[Openstack 설치 글]

[CLOUD/OpenStack] - Openstack-Victoria설치(사전작업)

[CLOUD/OpenStack] - [Victoria] Keystone 설치

[CLOUD/OpenStack] - [Victoria] Glance 설치

[CLOUD/OpenStack] - [Victoria] Nova 설치

[CLOUD/OpenStack] - [Victoria] Horizon 설치

[CLOUD/OpenStack] - [Victoria] Neutron 설치  

[CLOUD/OpenStack] - [Victoria] Cinder 설치

 

 

* Glance 설치는 Controller 노드에서 진행합니다.

 

1. 데이터 베이스 생성

 

Glance DB 패스워드 생성 시, 특수문자가 인식을 못하는 경우가 있으므로, 특수문자를 제외하고 만드시길 바랍니다.

해당 참고글: https://bugs.launchpad.net/glance/+bug/1695299

root@controller:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 208
Server version: 10.3.25-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database glance;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> grant all privileges on glance.* to 'glance'@'localhost' identified by 'GLANCE_DBPASS';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> grant all privileges on glance.* to 'glance'@'%' identified by 'GLANCE_DBPASS';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)

 

 

 

2. Glance 사용자, 서비스, 엔드포인트 생성하기

 

admin 환경으로 변경합니다.

root@controller:~# source admin-openrc

 

glance 사용자를 생성합니다.

admin 정책에 glance 사용자를 추가해줍니다.

root@controller:~# openstack user create --domain default --password GLANCE_PASS glance
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | c30fa99748de4afe97ec6c8307e3f6f6 |
| name | glance |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+


root@controller:~# openstack role add --project service --user glance admin

 

service glance를 생성해줍니다.

root@controller:~# openstack service create --name glance --description 'OpenStack Image' image
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Image |
| enabled | True |
| id | 72f317a4130b485493f655346544af4a |
| name | glance |
| type | image |
+-------------+----------------------------------+

 

image 서비스를 사용할 endpoint를 생성해줍니다. public, internal, admin 환경 3군데 진행해줍니다.

root@controller:~# openstack endpoint create --region Region01 image public http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 88a7da3c3d204d8888731ee685142769 |
| interface | public |
| region | Region01 |
| region_id | Region01 |
| service_id | 72f317a4130b485493f655346544af4a |
| service_name | glance |
| service_type | image |
| url | http://controller:9292 |
+--------------+----------------------------------+


root@controller:~# openstack endpoint create --region Region01 image internal http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | faebb68515954b6ea68eec17485c6990 |
| interface | internal |
| region | Region01 |
| region_id | Region01 |
| service_id | 72f317a4130b485493f655346544af4a |
| service_name | glance |
| service_type | image |
| url | http://controller:9292 |
+--------------+----------------------------------+


root@controller:~# openstack endpoint create --region Region01 image admin http://controller:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 1aef8efa6bbc4841a27c9cf765b8ab48 |
| interface | admin |
| region | Region01 |
| region_id | Region01 |
| service_id | 72f317a4130b485493f655346544af4a |
| service_name | glance |
| service_type | image |
| url | http://controller:9292 |
+--------------+----------------------------------+

 

서비스가 생성된 것을 확인합니다.

root@controller:~# openstack service list
+----------------------------------+----------+----------+
| ID | Name | Type |
+----------------------------------+----------+----------+
| 72f317a4130b485493f655346544af4a | glance | image |
| 8e6fb14bf15448f888cf6d8875f6a4ab | keystone | identity |
+----------------------------------+----------+----------+

 

Endpoint가 생성된 것을 확인합니다.

root@controller:~# openstack endpoint list
+----------------------------------+----------+--------------+--------------+---------+-----------+----------------------------+
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+----------------------------------+----------+--------------+--------------+---------+-----------+----------------------------+
| 1aef8efa6bbc4841a27c9cf765b8ab48 | Region01 | glance | image | True | admin | http://controller:9292 |
| 23752fde4dc54eae8081129314dab7a7 | Region01 | keystone | identity | True | internal | http://controller:5000/v3/ |
| 7af1377005644543baba35dd52fa8234 | Region01 | keystone | identity | True | admin | http://controller:5000/v3/ |
| 88a7da3c3d204d8888731ee685142769 | Region01 | glance | image | True | public | http://controller:9292 |
| a8d1a1edb7a4495fb380426fd26223f3 | Region01 | keystone | identity | True | public | http://controller:5000/v3/ |
| faebb68515954b6ea68eec17485c6990 | Region01 | glance | image | True | internal | http://controller:9292 |
+----------------------------------+----------+--------------+--------------+---------+-----------+----------------------------+

 

 

3. 방화벽

 

tcp/9292 포트를 열어줍니다 (glance-api)

tcp/9191 포트를 열어줍니다. (glance-registry)

 

 

4. 패키지 설치하기

 

root@controller:~# apt-get install glance -y

 

 

5. 설정파일 수정하기

 

glance-api.conf 파일은 Glance 서비스가 클라이언트로부터 API 요청을 받아들이기 위해 사용됩니다.

root@controller:~# cat /etc/glance/glance-api.conf
[DEFAULT]
show_image_direct_url = True
[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
backend = sqlalchemy

[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 = glance
password =  GLANCE_PASS

[paste_deploy]
flavor = keystone

[glance_store]
stores = file,http default_store = file
filesystem_store_datadir = /var/lib/glance/images/

[image_format]
disk_formats = ami,ari,aki,vhd,vhdx,vmdk,raw,qcow2,vdi,iso,ploop.root-tar

 

root@controller:~# chmod 640 /etc/glance/glance-api.conf
root@controller:~# chown root:glance /etc/glance/glance-api.conf

 

glance 관리명령어 glance-mange를 통해 glance 데이터베이스에 필요한 테이블을 생성합니다.

root@controller:~# su -s /bin/bash glance -c "glance-manage db_sync"

 

 

 

6. 서비스 시작하기

 

glance-api 서비스를 시작해줍니다.

root@controller:~# systemctl restart glance-api

glance-registry 서비스 포트 : 9191

glance-api 서비스 포트 : 9292

 

 

 

7. 검증하는 방법

 

admin 환경으로 들어가서 cirros OS 이미지를 다운받습니다.

다운받은 뒤, 해당 이미지로 생성합니다.

root@controller:~# wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img

root@controller:~# openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
| container_format | bare |
| created_at | 2021-04-29T12:45:32Z |
| disk_format | qcow2 |
| file | /v2/images/de1bb578-39bd-4227-b701-831c556e4abf/file |
| id | de1bb578-39bd-4227-b701-831c556e4abf |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | 21c9897cb20047b8a781baeccf08f67b |
| properties | os_hidden='False', owner_specified.openstack.md5='', owner_specified.openstack.object='images/cirros', owner_specified.openstack.sha256='' |
| protected | False |
| schema | /v2/schemas/image |
| status | queued | | tags |
| | updated_at | 2021-04-29T12:45:32Z |
| visibility | public |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------+


root@controller:~# openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| de1bb578-39bd-4227-b701-831c556e4abf | cirros | active |
+--------------------------------------+--------+--------+

 

 

 

 

반응형

'OpenStack' 카테고리의 다른 글

[Victoria] Nova 설치  (0) 2020.10.04
[정리] Nova 이론  (0) 2020.10.04
[정리] Glance 이론  (0) 2020.09.20
[Victoria] Keystone 설치  (0) 2020.09.17
[정리] KeyStone 이론  (0) 2020.09.15
profile

YUMSERV

@lena04301

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!