Ubuntu 22.04
Sponsored Link

OpenStack Antelope : Skyline 設定2023/03/30

 
OpenStack Dashboard Service(Skyline)をインストールします。
当例では以下のような環境を例に Skyline をインストールします。
------------+--------------------------+--------------------------+------------
            |                          |                          |
        eth0|10.0.0.30             eth0|10.0.0.50             eth0|10.0.0.51
+-----------+-----------+  +-----------+-----------+  +-----------+-----------+
|   [ dlp.srv.world ]   |  | [ network.srv.world ] |  |  [ node01.srv.world ] |
|     (Control Node)    |  |     (Network Node)    |  |     (Compute Node)    |
|                       |  |                       |  |                       |
|  MariaDB    RabbitMQ  |  |      Open vSwitch     |  |        Libvirt        |
|  Memcached  Nginx     |  |     Neutron Server    |  |      Nova Compute     |
|  Keystone   httpd     |  |      OVN-Northd       |  |      Open vSwitch     |
|  Glance     Nova API  |  |  Nginx  iSCSI Target  |  |   OVN Metadata Agent  |
|  Cinder API           |  |     Cinder Volume     |  |     OVN-Controller    |
|  Skyline API/Console  |  |    Heat API/Engine    |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1] Control ノードの Keystone に Skyline 用のユーザー等々を登録しておきます。
# [service] プロジェクト所属で [skyline] ユーザーを作成

root@dlp ~(keystone)#
openstack user create --domain default --project service --password servicepassword skyline

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | d3dd87fb1a034f7883539a6a4f83781f |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 7ff47d496710451da563f7f09c08927c |
| name                | skyline                          |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# [skyline] ユーザーを [admin] ロール に加える

root@dlp ~(keystone)#
openstack role add --project service --user skyline admin
[2] Skyline 用のユーザーとデータベースを MariaDB に作成しておきます。
root@dlp ~(keystone)#
mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 113
Server version: 10.6.12-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.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 skyline; 
Query OK, 1 row affected (0.00 sec)

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

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

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

MariaDB [(none)]> exit 
Bye
[3] Skyline API の設定です。
root@dlp ~(keystone)#
groupadd -g 64080 skyline

root@dlp ~(keystone)#
useradd -u 64080 -g skyline -d /var/lib/skyline -s /sbin/nologin skyline

root@dlp ~(keystone)#
mkdir -p /etc/skyline /var/lib/skyline /var/log/skyline

root@dlp ~(keystone)#
chmod 750 /etc/skyline /var/lib/skyline /var/log/skyline
root@dlp ~(keystone)#
pip3 install skyline-apiserver

root@dlp ~(keystone)#
git clone https://opendev.org/openstack/skyline-apiserver.git

root@dlp ~(keystone)#
cp ./skyline-apiserver/etc/gunicorn.py /etc/skyline/gunicorn.py

root@dlp ~(keystone)#
cp ./skyline-apiserver/etc/skyline.yaml.sample /etc/skyline/skyline.yaml

root@dlp ~(keystone)#
vi /etc/skyline/gunicorn.py
# 17行目 : 変更

bind = "
127.0.0.1:28000
"
root@dlp ~(keystone)#
vi /etc/skyline/skyline.yaml
# 5行目 : MariaDB 接続情報
database_url: mysql://skyline:password@dlp.srv.world/skyline

# 7行目 : 変更
log_dir: /var/log/skyline

# 27行目 : Keystone 認証情報
keystone_url: https://dlp.srv.world:5000

# 59行目 : Slyline ユーザーのパスワード
  system_user_domain: Default
  system_user_name: skyline
  system_user_password: 'servicepassword'

root@dlp ~(keystone)#
cd ./skyline-apiserver

root@dlp skyline-apiserver(keystone)#
make db_sync

alembic -c skyline_apiserver/db/alembic/alembic.ini upgrade head
2023-03-30 10:48:07.135 | INFO     | alembic.runtime.migration:__init__:204 - Context impl MySQLImpl.
2023-03-30 10:48:07.135 | INFO     | alembic.runtime.migration:__init__:207 - Will assume non-transactional DDL.
2023-03-30 10:48:07.154 | INFO     | alembic.runtime.migration:run_migrations:618 - Running upgrade  -> 000, init

root@dlp skyline-apiserver(keystone)#
root@dlp ~(keystone)#
chown -R skyline. /etc/skyline /var/lib/skyline /var/log/skyline

root@dlp ~(keystone)#
vi /etc/systemd/system/skyline-apiserver.service
# 新規作成

[Unit]
Description=OpenStack Skyline APIServer

[Service]
User=skyline
Group=skyline
Type=simple
ExecStart=/usr/local/bin/gunicorn -c /etc/skyline/gunicorn.py skyline_apiserver.main:app
LimitNOFILE=32768
Restart=on-failure
TimeoutStopSec=15

[Install]
WantedBy=multi-user.target

root@dlp ~(keystone)#
systemctl daemon-reload

root@dlp ~(keystone)#
systemctl enable --now skyline-apiserver

[4] Skyline Console の設定です。
root@dlp ~(keystone)#
apt -y install npm python-is-python3

root@dlp ~(keystone)#
npm install -g yarn
root@dlp ~(keystone)#
git clone https://opendev.org/openstack/skyline-console.git

root@dlp ~(keystone)#
cd ./skyline-console

root@dlp skyline-console(keystone)#
make package

root@dlp skyline-console(keystone)#
pip3 install --force-reinstall ./dist/skyline_console-*.whl

root@dlp skyline-console(keystone)#
root@dlp ~(keystone)#
vi /etc/nginx/conf.d/skyline.conf
# 新規作成

upstream skyline {
    server 127.0.0.1:28000 fail_timeout=0;
}
server {
    listen       9999 ssl http2 default_server;
    server_name  dlp.srv.world;
    root         /usr/local/lib/python3.10/dist-packages/skyline_console/static;
    index        index.html;

    # 自身の証明書に置き換え
    ssl_certificate "/etc/letsencrypt/live/dlp.srv.world/fullchain.pem";
    ssl_certificate_key "/etc/letsencrypt/live/dlp.srv.world/privkey.pem";
    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout  10m;

    error_page 497 https://$http_host$request_uri;

    location / {
        try_files $uri $uri/ /index.html;
        expires 1d;
        add_header Cache-Control "public";
    }

    location /api/openstack/skyline/ {
        proxy_pass http://skyline/;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Host $http_host;
    }

    # 自身の Nova Endpoint に置き換え
    location /api/openstack/regionone/nova/ {
        proxy_pass https://dlp.srv.world:8774/;
        proxy_redirect https://dlp.srv.world:8774/ /api/openstack/regionone/nova/;
        proxy_buffering off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Host $http_host;
    }

    # 自身の Keystone Endpoint に置き換え
    location /api/openstack/regionone/keystone/ {
        proxy_pass https://dlp.srv.world:5000/;
        proxy_redirect https://dlp.srv.world:5000/ /api/openstack/regionone/keystone/;
        proxy_buffering off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Host $http_host;
    }

    # 自身の Glance Endpoint に置き換え
    location /api/openstack/regionone/glance/ {
        proxy_pass https://dlp.srv.world:9292/;
        proxy_redirect https://dlp.srv.world:9292/ /api/openstack/regionone/glance/;
        proxy_buffering off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Host $http_host;
    }

    # 自身の Neutron Endpoint に置き換え
    location /api/openstack/regionone/neutron/ {
        proxy_pass https://network.srv.world:9696/;
        proxy_redirect https://network.srv.world:9696/ /api/openstack/regionone/neutron/;
        proxy_buffering off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Host $http_host;
    }

    # 自身の Heat Endpoint に置き換え
    location /api/openstack/regionone/heat/ {
        proxy_pass https://network.srv.world:8004/;
        proxy_redirect https://network.srv.world:8004/ /api/openstack/regionone/heat/;
        proxy_buffering off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Host $http_host;
    }

    # 自身の Placement Endpoint に置き換え
    location /api/openstack/regionone/placement/ {
        proxy_pass https://dlp.srv.world:8778/;
        proxy_redirect https://dlp.srv.world:8778/ /api/openstack/regionone/placement/;
        proxy_buffering off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Host $http_host;
    }

    # 自身の Cinder Endpoint に置き換え
    location /api/openstack/regionone/cinder/ {
        proxy_pass https://dlp.srv.world:8776/;
        proxy_redirect https://dlp.srv.world:8776/ /api/openstack/regionone/cinder/;
        proxy_buffering off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Host $http_host;
    }
}

root@dlp ~(keystone)#
systemctl restart nginx

[5]
任意のホストで Web ブラウザーを起動し、以下の URL にアクセスします。
⇒ https://(サーバーのホスト名 - 証明書に登録した FQDN と同じ名前):9999/
アクセスすると Skyline Dashboard のログイン画面が表示されます。任意の Openstack ユーザーでログインします。
[6] ログインすると以下のように Skyline Dashboard のメイン画面になります。
[7] 動作確認として インスタンスを作成します。
左ペインで [Instances] を選択し、右ペインで [Create Instance] をクリックします。
[8] 使用するイメージやディスクの設定をします。
[9] ネットワークとセキュリティグループを設定をします。
[10] インスタンス名とキーペアの設定をします。
[11] 設定内容を確認して [Confirm] ボタンをクリックします。
[12] 以下のように 正常にインスタンスが作成/起動され、[Status] が [Active] になれば OK です。
関連コンテンツ