microstackを使ってAWS上のubuntu20.04上にopenstackを構築する
やること
microstackを使ってAWS上のubuntu20.04上にopenstackを構築する
手順
AWSでubuntu20.04のVMを作成する
microstackのrequirementsを見る
memory 16G, disk 50Gが必要
Ref: https://ubuntu.com/openstack/install
リソースを割り当ててVMを起動
注意
自分のlocalマシンのsshの公開鍵を登録してVMを起動することを忘れずに。これを忘れると作ったVMにsshアクセスできない。画面省略。
作られたVMへsshアクセス
# xxx.xxx.xxx.xxxはVMに自動的に割り当てられたパブリックIPv4アドレスを指0900定
$ ssh xxx.xxx.xxx.xxx -l ubuntu
snapでmicrostackをinstall
Ref: https://ubuntu.com/openstack/install の2
$ sudo snap install microstack --beta --devmode
microstack (beta) ussuri from Canonical✓ installed
microstackを初期化
Ref: https://ubuntu.com/openstack/install の3
$ sudo microstack init --auto --control
...
2021-05-11 04:47:34,227 - microstack_init - INFO - Complete. Marked microstack as initialized!
VMのsecurity groupにhttpアクセスをinboundで追加
これで自分のlocalマシンからVM(OpenStackのhorizon)へhttpアクセスできるようになる。
httpでhorizonにアクセスしてみる
horizonにloginする時のpasswordは以下のコマンドで取得できる
$ sudo snap get microstack config.credentials.keystone-password
その上でhttp://[VMのパブリックIPv4アドレス]でhorizonにアクセスできる。
sshの鍵をopenstackに登録
# openstackをinstallしたubuntu20.04マシンにて
$ ssh-keygen
このあたりからkeyを登録
OpenStack上からVMを作成してみる
oepnstackコマンドからVMを作ってみる
microstack.openstackをopenstackで実行できるようにする
Ref: https://tech.virtualtech.jp/entry/2019/12/17/113221
$ sudo snap alias microstack.openstack openstack
VMを作成
# flavorを確認
$ openstack flavor list
+----+-----------+-------+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+-------+------+-----------+-------+-----------+
| 1 | m1.tiny | 512 | 1 | 0 | 1 | True |
| 2 | m1.small | 2048 | 20 | 0 | 1 | True |
| 3 | m1.medium | 4096 | 20 | 0 | 2 | True |
| 4 | m1.large | 8192 | 20 | 0 | 4 | True |
| 5 | m1.xlarge | 16384 | 20 | 0 | 8 | True |
+----+-----------+-------+------+-----------+-------+-----------+
# networkを確認
$ openstack network list
op+--------------------------------------+----------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+----------+--------------------------------------+
| 75b06726-f1cc-44db-b9e1-bd1e4ca59bc3 | test | cc026fdd-15b1-40a1-b635-ba92501d0be4 |
| ca00dd2c-022b-4315-99c9-8eee336add76 | external | 78eba1c9-18af-4958-9910-7949cd92e563 |
+--------------------------------------+----------+--------------------------------------+
# imageを確認
$ microstack.openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
| 388183f7-2c11-423b-9070-075372a50167 | cirros | active |
+--------------------------------------+--------+--------+
# key-pairを確認
$ microstack.openstack keypair list
+---------------+-------------------------------------------------+
| Name | Fingerprint |
+---------------+-------------------------------------------------+
| local-machine | fa:3d:46:e7:88:14:c4:52:e2:1a:39:d3:8c:d1:20:21 |
+---------------+-------------------------------------------------+
# 以上を踏まえてVMを作成
$ microstack.openstack server create --flavor m1.tiny --nic net-id=test --image cirros --key-name local-machine microstack-cirros
# 作成されたVMを確認
$ openstack server list
+--------------------------------------+-------------------+--------+------------------------------------+--------------+----------+
| ID | Name | Status | Networks | Image | Flavor |
+--------------------------------------+-------------------+--------+------------------------------------+--------------+----------+
| aa77cf28-0136-44d1-a372-cf1a961d50c9 | microstack-cirros | ACTIVE | test=192.168.222.216 | cirros | m1.tiny |
| 5399d01c-8dbc-4a28-a9b6-079984dc79d5 | test | ACTIVE | test=192.168.222.165, 10.20.20.191 | cirros | m1.tiny |
+--------------------------------------+-------------------+--------+------------------------------------+--------------+----------+
# floating ipを生成
$ openstack floating ip create external
+---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at | 2021-05-11T05:30:10Z |
| description | |
| dns_domain | None |
| dns_name | None |
| fixed_ip_address | None |
| floating_ip_address | 10.20.20.101 |
| floating_network_id | ca00dd2c-022b-4315-99c9-8eee336add76 |
| id | ecb68ff3-6539-4324-8d25-90a643cac34e |
| location | Munch({'cloud': '', 'region_name': '', 'zone': None, 'project': Munch({'id': 'b8ca3797e44b463c916dd2b3177459dd', 'name': 'admin', 'domain_id': None, 'domain_name': 'default'})}) |
| name | 10.20.20.101 |
| port_details | None |
| port_id | None |
| project_id | b8ca3797e44b463c916dd2b3177459dd |
| qos_policy_id | None |
| revision_number | 0 |
| router_id | None |
| status | DOWN |
| subnet_id | None |
| tags | [] |
| updated_at | 2021-05-11T05:30:10Z |
+---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
ubuntu@ip-172-31-24-26:~$
# floating ipをVMに割り付け
$ openstack server add floating ip microstack-cirros 10.20.20.101
# sshでVMにlogin
$ ssh [email protected]
OpenStackにubuntu18.04のimageを追加してみる
bash
$ wget https://cloud-images.ubuntu.com/releases/bionic/release/ubuntu-18.04-server-cloudimg-amd64.img
$ openstack image create --disk-format qcow2 --container-format bare \
--public --file ./ubuntu-18.04-server-cloudimg-amd64.img ubuntu-18.04
$ openstack image list
+--------------------------------------+--------------+--------+
| ID | Name | Status |
+--------------------------------------+--------------+--------+
| 388183f7-2c11-423b-9070-075372a50167 | cirros | active |
| e3547636-ca09-49b3-b06a-6b2d47a81bf1 | ubuntu-18.04 | active |
+--------------------------------------+--------------+--------+
$ wget https://cloud-images.ubuntu.com/releases/bionic/release/ubuntu-18.04-server-cloudimg-amd64.img
$ openstack image create --disk-format qcow2 --container-format bare \
--public --file ./ubuntu-18.04-server-cloudimg-amd64.img ubuntu-18.04
$ openstack image list
+--------------------------------------+--------------+--------+
| ID | Name | Status |
+--------------------------------------+--------------+--------+
| 388183f7-2c11-423b-9070-075372a50167 | cirros | active |
| e3547636-ca09-49b3-b06a-6b2d47a81bf1 | ubuntu-18.04 | active |
+--------------------------------------+--------------+--------+
Author And Source
この問題について(microstackを使ってAWS上のubuntu20.04上にopenstackを構築する), 我々は、より多くの情報をここで見つけました https://qiita.com/iguchikoma/items/abfe7cdcfc01a0486455著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .