DevStackを用いてOpenStack構築しようとしたらトラブルの嵐だったので、メモがわりにトラシュー記録。
気が向いたら見やすくします。 chu☆
全体の流れ
1,virtual box にubuntu20.04をインポート。(18.〜とかは上手く行かずやめた。)
2,メモリは5GB、ディスクは実容量で10GBは欲しい。(partedとか使って適用するの忘れない)
3,始めubuntuにログインできず、リカバリーモードでrootのパスワード変えた。。cloud-init使うといいらしい。
4,NAT×1,ホストオンリー×1で構成するが、ネットワーク設定は,ubuntu20.04はnetplan配下に99_config.yamlとか作ってnetplan applyする。
stack@ubuntu:/$ vi /etc/netplan/99_config.yaml
network:
version: 2
ethernets:
enp0s3:#こっちがNAT用
addresses: [10.0.2.100/24]
nameservers:
addresses: [8.8.8.8]
gateway4: 10.0.2.2
enp0s8:#こっちがホストオンリー
dhcp4: true
dhcp6: false
5,virtualboxのコマンドラインはコピペ設定とか遅延して面倒なので、ssh接続できるようにする。下のようにopenssh-serverインストール。/etc/ssh/sshd_configを編集し、(ホントはrootログインしないようにした方がいい。)ホストOSのmacのターミナルとvirtualboxのゲストOS両方でsshの鍵を作成する。(下記の参考にしたサイトを参照)
stack@ubuntu:/$ vi /etc/ssh/sshd_config
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
# IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
# IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
# PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Kerberos options
# KerberosAuthentication no
# KerberosOrLocalPasswd yes
# KerberosTicketCleanup yes
# KerberosGetAFSToken no
# GSSAPI options
# GSSAPIAuthentication no
# GSSAPICleanupCredentials yes
# GSSAPIStrictAcceptorCheck yes
# GSSAPIKeyExchange no
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
# AllowAgentForwarding yes
# AllowTcpForwarding yes
# GatewayPorts no
X11Forwarding yes
# X11DisplayOffset 10
# X11UseLocalhost yes
# PermitTTY yes
PrintMotd no
# PrintLastLog yes
# TCPKeepAlive yes
# PermitUserEnvironment no
# Compression delayed
# ClientAliveInterval 0
# ClientAliveCountMax 3
# UseDNS no
# PidFile /var/run/sshd.pid
# MaxStartups 10:30:100
# PermitTunnel no
# ChrootDirectory none
# VersionAddendum none
# no default banner path
# Banner none
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
# override default of no subsystems
Subsystem sftp /usr/lib/openssh/sftp-server
# Example of overriding settings on a per-user basis
# Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
$ sudo apt-get install openssh-server
これでゲストのIP(ホストオンリーアダプタの方)にsshでログインできる。
6,いよいよDevStackのインストール。下記のクイックスタートを参考。まず、rootでユーザーを作ってそっちに移った方がいい。
local.confというファイルがdevstack/samples配下にあるが、それをdevstack直下にcpして編集。ここは公式サイトと違う編集。
特にdisable_service etcd3は入れないと起動できなかった。(コメントアウト部分参照)
stack@ubuntu:~/devstack$ vi local.conf
# Sample ``local.conf`` for user-configurable variables in ``stack.sh``
# NOTE: Copy this file to the root DevStack directory for it to work properly.
# ``local.conf`` is a user-maintained settings file that is sourced from ``stackrc``.
# This gives it the ability to override any variables set in ``stackrc``.
# Also, most of the settings in ``stack.sh`` are written to only be set if no
# value has already been set; this lets ``local.conf`` effectively override the
# default values.
# This is a collection of some of the settings we have found to be useful
# in our DevStack development environments. Additional settings are described
# in https://docs.openstack.org/devstack/latest/configuration.html#local-conf
# These should be considered as samples and are unsupported DevStack code.
# The ``localrc`` section replaces the old ``localrc`` configuration file.
# Note that if ``localrc`` is present it will be used in favor of this section.
[[local|localrc]]
# Minimal Contents
# ----------------
# While ``stack.sh`` is happy to run without ``localrc``, devlife is better when
# there are a few minimal variables set:
# If the ``*_PASSWORD`` variables are not set here you will be prompted to enter
# values for them by ``stack.sh``and they will be added to ``local.conf``.
ADMIN_PASSWORD=secret #これが後々アクセスするのに必要になる。下記($ADMIN_PASSWORD)はこのパスワードと同値になるということ
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
# ``HOST_IP`` and ``HOST_IPV6`` should be set manually for best results if
# the NIC configuration of the host is unusual, i.e. ``eth1`` has the default
# route but ``eth0`` is the public interface. They are auto-detected in
# ``stack.sh`` but often is indeterminate on later runs due to the IP moving
# from an Ethernet interface to a bridge on the host. Setting it here also
# makes it available for ``openrc`` to include when setting ``OS_AUTH_URL``.
# Neither is set by default.
HOST_IP=[今はゲストIPがホストIP(ホストオンリーアダプタのやつ)]
# HOST_IPV6=2001:db8::7
# Logging
# -------
# By default ``stack.sh`` output only goes to the terminal where it runs. It can
# be configured to additionally log to a file by setting ``LOGFILE`` to the full
# path of the destination log file. A timestamp will be appended to the given name.
LOGFILE=$DEST/logs/stack.sh.log
# Old log files are automatically removed after 7 days to keep things neat. Change
# the number of days by setting ``LOGDAYS``.
LOGDAYS=2
# Nova logs will be colorized if ``SYSLOG`` is not set; turn this off by setting
# ``LOG_COLOR`` false.
# LOG_COLOR=False
# Using milestone-proposed branches
# ---------------------------------
# Uncomment these to grab the milestone-proposed branches from the
# repos:
# CINDER_BRANCH=milestone-proposed
# GLANCE_BRANCH=milestone-proposed
# HORIZON_BRANCH=milestone-proposed
# KEYSTONE_BRANCH=milestone-proposed
# KEYSTONECLIENT_BRANCH=milestone-proposed
# NOVA_BRANCH=milestone-proposed
# NOVACLIENT_BRANCH=milestone-proposed
# NEUTRON_BRANCH=milestone-proposed
# SWIFT_BRANCH=milestone-proposed
# Using git versions of clients
# -----------------------------
# By default clients are installed from pip. See LIBS_FROM_GIT in
# stackrc for details on getting clients from specific branches or
# revisions. e.g.
# LIBS_FROM_GIT="python-ironicclient"
# IRONICCLIENT_BRANCH=refs/changes/44/2.../1
# Swift
# -----
# Swift is now used as the back-end for the S3-like object store. Setting the
# hash value is required and you will be prompted for it if Swift is enabled
# so just set it to something already:
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
# For development purposes the default of 3 replicas is usually not required.
# Set this to 1 to save some resources:
SWIFT_REPLICAS=1
# The data for Swift is stored by default in (``$DEST/data/swift``),
# or (``$DATA_DIR/swift``) if ``DATA_DIR`` has been set, and can be
# moved by setting ``SWIFT_DATA_DIR``. The directory will be created
# if it does not exist.
SWIFT_DATA_DIR=$DEST/data
disable_service etcd3
7,いよいよ./stack.shを叩いて実行する。ここでは止まったらトラシューするが、自分はplacement関係とg-api関係とovn関係でハマった。placement関係とg-api関係はメモリとかちゃんと./unstack.sh -> ./clean.sh をするとかちゃんとrebootするとかで治ったが、ovnはなんと./clean.shが正常にrm -r 対象ファイルで 消せておらず、別途下記コマンドをクリーンアップののち叩いて、正常なスクリプト実行(./stack.sh)を行った。
stack@ubuntu:~/devstack$ sudo rm -r /var/run/ovn
以下のようにクリーンアップが失敗しているので手動で行った。
lib/neutron_plugins/ovn_agent:cleanup_ovn:796 sudo rm -f /var/run/ovn
rm: cannot remove '/var/run/ovn': Is a directory
+unstack.sh:main:166 is_service_enabled etcd3
+functions-common:is_se
apache2を削除するような記事があったが、消しちゃうと二度とスクリプトでインストールされなかったりする。大きいスクリプトは追うのが大変ですね。。
そんなこんなでメモリ足りなくなったりして、都度増やし、なんとか成功。
Services are running under systemd unit files.
For more information see:
https://docs.openstack.org/devstack/latest/systemd.html
DevStack Version: yoga
Change: 62d6ffa6b3278023d1e385bd50810e0d091e0bc3 Merge "Revert "Disable enforcing scopes in Neutron temporary"" 2022-02-08 22:41:18 +0000
OS Version: Ubuntu 20.04 focal
環境
・Mac book pro
・virtual box 6.1
・ubuntu 20.04 下記のクラウドイメージを仮想アプライアンスとして適用
Ubuntu 20.04 LTS (Focal Fossa) [20220207]
参考にしたサイト
DevStack-クイックスタート(公式)
そもそも参考にするサイトでうまく行くか大きく変わる。。。