2021년 10월 7일 목요일

Install OpenStack Victoria on CentOS 8

 

  • VM 3개를 준비함 (controller, compute1, compute2)
    • controller : 4vCPU, 8GB
      • vdisk1 : 200GB
      • vdisk2 : 40GB (cinder 용)
      • vNIC1 : 사설 관리망(인터넷 안됨, 예: 10.10.10.0/24)
      • vNIC2 : OpenStack 에서 생성한 VM 에게 부여할 사설 IP(인터넷 안됨, 예: 20.20.20.0/24)
      • vNIC3: 외부망(인터넷 됨: 예: 172.16.10.0/24)
    • compute1, 2: 4vCPU, 8GB
      • vdisk1 : 200GB
      • vNIC1 : 사설 관리망(인터넷 안됨, 예: 10.10.10.0/24)
      • vNIC2 : OpenStack 에서 생성한 VM 에게 부여할 사설 IP(인터넷 안됨, 예: 20.20.20.0/24)
      • vNIC3: 외부망(인터넷 됨: 예: 172.16.10.0/24)

  • 모든 노드에 대해 hostname 설정
sudo hostnamectl set-hostname cont30.mytec.com
sudo hostnamectl set-hostname comp1.mytec.com
sudo hostnamectl set-hostname comp2.mytec
.com

  • 각 노드의 /etc/hosts 파일 수정
    • public ip 가 아닌 priviate ip 로 함
# vim /etc/hosts
10.10.10.x	cont30.mytec.com	cont30
10.10.10.y comp1.mytec.com comp1
10.10.10.z comp2.mytec
.com comp2
  • Disable IPv6 (모든 노드)
# vim /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

아래 명령어로 확인
# sysctl -p
  • Set Max PID (모든 노드)
# echo kernel.pid_max = 65536 >> /etc/sysctl.conf

아래 명령어로 확인
# sysctl -p

  • disable SELINUX (모든 노드)
# setenforce 0

Modify 'SELINUX=disabled' in the file '/etc/sysconfig/selinux' to disable permanently.

# vim /etc/sysconfig/selinux
SELINUX=disabled

(여기까지 하고 VM snapshot 뜨는 것도 좋음)

  • install network-scripts
  • disable firewalld and NetworkManager and then enable network
sudo dnf install -y network-scripts
sudo systemctl disable --now firewalld NetworkManager
sudo systemctl enable network && sudo systemctl start network

  • Disable deprecated warnings:
sudo touch /etc/sysconfig/disable-deprecation-warnings

  • network 서비스 상태 확인
systemctl status network
  • updatesystem and install basic utilities
sudo dnf -y install vim wget curl telnet bash-completion network-scripts dnf-utils

  • OpenStack Victoria 또는 특정 release repository 추가
    • 더 최신 release 가 있다면 그것도 가능
sudo dnf config-manager --enable powertools
또는 dnf config-manager --enable PowerTools

sudo dnf install -y centos-release-openstack-victoria
또는
sudo dnf install -y centos-release-openstack-ussuri

sudo dnf -y update
  • install packstack package for CentOS.
# sudo dnf install -y openstack-packstack

위 명령 에러나면 아래 참고해서 troubleshooting

wget https://cbs.centos.org/kojifiles/packages/puppet-xinetd/3.3.0/2.8d460c4git.el8/noarch/puppet-xinetd-3.3.0-2.8d460c4git.el8.noarch.rpm
rpm -Uvh puppet-xinetd-3.3.0-2.8d460c4git.el8.noarch.rpm
rpm -Uvh https://yum.puppet.com/puppet6-release-el-8.noarch.rpm
yum repolist
rpm -Uvh puppet-xinetd-3.3.0-2.8d460c4git.el8.noarch.rpm
yum install -y puppetserver
rpm -Uvh puppet-xinetd-3.3.0-2.8d460c4git.el8.noarch.rpm

[root@openstack openstack]# rpm -Uvh puppet-xinetd-3.3.0-2.8d460c4git.el8.noarch.rpm
error: Failed dependencies:
puppet-stdlib is needed by puppet-xinetd-3.3.0-2.8d460c4git.el8.noarch

wget http://repos2.reduniv.edu.cu/REPOSITORIOS_SWL/CENTOS/centos/8/cloud/x86_64/openstack-ussuri/Packages/p/puppet-stdlib-6.3.0-1.93eee77git.el8.noarch.rpm
rpm -Uvh puppet-stdlib-6.3.0-1.93eee77git.el8.noarch.rpm
rpm -Uvh puppet-xinetd-3.3.0-2.8d460c4git.el8.noarch.rpm
위 명령어 참고해서 troubleshooting 한 다음 아래 명령 다시 시도
# sudo dnf install -y openstack-packstack

아래 명령어 통해 packstack 잘 설치 되었는지 확인
# packstack --version

Enable virt module

sudo dnf -y module enable virt

Update system:

sudo dnf update -y
sudo systemctl reboot

  • Create a PV & VG on Controller node for Cinder backend
아래 3가지는 안해도 될 것 같으나, cinder 를 위한 볼륨이 있다면 하는 것이 좋을 것 같음
pvcreate /dev/sdb
vgcreate cinder-volumes /dev/sdb
reboot
# 위 명령어 시에 아래와 같은 에러 발생한다면 vdisk2 를 생성안 한 것이므로, 2nd vdisk 생성 후 다시 시도함
No device found for /dev/sdb.

  • packstack 에서 사용할 answer 파일 생성 (openstack-answer.txt)
packstack --gen-answer-file=openstack-answer.txt
  • 아래 내용으로 openstack-answer.txt 변경
# 위에서 cinder-volumes 만들었다면
CONFIG_CINDER_VOLUMES_CREATE=n

CONFIG_NEUTRON_ML2_TYPE_DRIVERS=vxlan,flat,vlan
CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES=vxlan
CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS=openvswitch
CONFIG_NEUTRON_ML2_TUNNEL_ID_RANGES=10:1000
CONFIG_NEUTRON_L2_AGENT=openvswitch
CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=extnet:br-ex
CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:ens256
CONFIG_NEUTRON_OVS_TUNNEL_IF=ens224
CONFIG_NEUTRON_OVS_TUNNEL_SUBNETS=20.20.20.0/24
CONFIG_NEUTRON_METERING_AGENT_INSTALL=n


# compute host private ip 추가
CONFIG_COMPUTE_HOSTS=10.10.10.60,10.10.10.61

# controller host 에 private ip 가 아닌 public ip 가 설정되어 있다면
# 모든 controller public ip -> private ip 로 변경함
CONFIG_CONTROLLER_HOST=10.10.10.62

# 아니면 controller, compute 등 모든 openstack node 의 ip 를 public ip 로 하는 것도 문제는 없음
sudo packstack --answer-file openstack-answer.txt

아래와 비슷한 화면이 출력됨
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20211006-021435-bbcro3di/openstack-setup.log

Installing:
Clean Up                                             [ DONE ]
Discovering ip protocol version                      [ DONE ]
Setting up ssh keys                                  [ DONE ]
Preparing servers                                    [ DONE ]
Pre installing Puppet and discovering hosts' details [ DONE ]
Preparing pre-install entries                        [ DONE ]
Setting up CACERT                                    [ DONE ]
Preparing AMQP entries                               [ DONE ]
Preparing MariaDB entries                            [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Preparing Keystone entries                           [ DONE ]
Preparing Glance entries                             [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Preparing Cinder entries                             [ DONE ]
Preparing Nova API entries                           [ DONE ]
Creating ssh keys for Nova migration                 [ DONE ]
Gathering ssh host keys for Nova migration           [ DONE ]
Preparing Nova Compute entries                       [ DONE ]
Preparing Nova Scheduler entries                     [ DONE ]
Preparing Nova VNC Proxy entries                     [ DONE ]
Preparing OpenStack Network-related Nova entries     [ DONE ]
Preparing Nova Common entries                        [ DONE ]
Preparing Neutron API entries                        [ DONE ]
Preparing Neutron L3 entries                         [ DONE ]
Preparing Neutron L2 Agent entries                   [ DONE ]
Preparing Neutron DHCP Agent entries                 [ DONE ]
Preparing Neutron Metering Agent entries             [ DONE ]
Checking if NetworkManager is enabled and running    [ DONE ]
Preparing OpenStack Client entries                   [ DONE ]
Preparing Horizon entries                            [ DONE ]
Preparing Swift builder entries                      [ DONE ]
Preparing Swift proxy entries                        [ DONE ]
Preparing Swift storage entries                      [ DONE ]
Preparing Gnocchi entries                            [ DONE ]
Preparing Redis entries                              [ DONE ]
Preparing Ceilometer entries                         [ DONE ]
Preparing Aodh entries                               [ DONE ]
Preparing Puppet manifests                           [ DONE ]
Copying Puppet modules and manifests                 [ DONE ]

  • 시간 동기화 안되어 있다면 지금이라도 함 (모든 노드)
    • /etc/chrony.conf 수정
    server 172.16.10.254 iburst
    sudo systemctl restart chronyd
    
    아래 명령어로 동기화 여부 확인
    chronyc sources -v
  • 설치 성공시 아래와 같은 화면 나옴
**** Installation completed successfully ******

Additional information:
 * Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
 * File /root/keystonerc_admin has been created on OpenStack client host 172.16.4.154. To use the command line tools you need to source the file.
 * To access the OpenStack Dashboard browse to http://172.16.4.154/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
 * The installation log file is available at: /var/tmp/packstack/20210930-141044-htz9ivmn/openstack-setup.log
 * The generated manifests are available at: /var/tmp/packstack/20210930-141044-htz9ivmn/manifests

  • 디폴트로생성되는 openstack network, router 들이 있는지 확인 후, 있으면 일단 제거
openstack network list
openstack router list

openstack network delete <network>
openstack router delete <delete>

삭제 시 에러나면 아래 링크 참고해서 troubleshooting
https://dischord.org/2016/01/05/cleaning-up-after-neutron/

  • 아래와 같이 OpenStack VM 에서 사용할 내부, 외부 네트워크 생성
    • 아래는 overlay network 로 vxlan 을 사용함
* 내부 네트워크 생성
openstack router create router1
openstack network create int_net --provider-network-type vxlan
openstack subnet create int_sub \
 --network int_net --dns-nameserver 172.16.10.254 \
 --subnet-range 20.20.20.0/24 --gateway 20.20.20.1
openstack router add subnet router1 int_sub
 
* 외부 네트워크 생성
openstack network create \
 --provider-physical-network extnet \
 --provider-network-type flat --external ext_net
 
openstack subnet create ext_sub \
 --network ext_net --subnet-range 172.16.4.0/24 \
 --allocation-pool start=172.16.4.221,end=172.16.4.240 \
 --gateway 172.16.4.1 --dns-nameserver 172.16.10.254 --no-dhcp
 
openstack network list
openstack subnet list

openstack network set --external ext_net
neutron router-gateway-set router1 ext_net
openstack router show router1

  • 위 방식으로 network, subnet, router 등 생성 후 VM 생성함
    • VM 생성되면 VM 에 사설 IP 인 20.20.20.xxx 가 붙음
    • 생성된 VM 클릭해서 콘솔로 접속 시도
      • 웹에서 콘솔 접속 하는 IP 10.10.10.xxx 대역의 사설 IP 라서 외부에서 접속이 안될 것이므로 대응되는 172.16.4.xxx 대역으로 접속하면 됨
      • 콘솔 접속 후 VM to 외부 (예: ping 8.8.8.8) ping 하면 성공해야 함
  • 외부에서 ping to VM 하면 안됨
    • 외부 접속을 위해 floating IP 가 필요함
  • VM 에 floating IP 할당함
  • 외부에서 ping to VM's floating IP 하면 성공해야 하나 아마 실패할 것임
    • 실패하면 보안그룹에서 inbound, outbound ICMP, TCP, UDP 규칙을 보고 추가해 주면 됨
  • ping 까지 성공하면 ssh to VM's floating IP 까지 성공해야 함

댓글 없음:

댓글 쓰기