packstack搭建openstack(V版)
一、环境规划
| 主机名 | ip | cpu/内存 | 角色 | 备注 |
|---|---|---|---|---|
| controller | 192.168.50.61 | 4c8g | 控制/网络/计算节点 | 必须开启虚拟化引擎 |
| compute | 192.168.50.62 | 4c8g | 计算节点 | 必须开启虚拟化引擎 |
都是nat模式
二、系统环境配置
2.1 网络配置
2.1.1 控制节点
[root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
BOOTPROTO=none
NAME=ens160
DEVICE=ens160
ONBOOT=yes
IPADDR=192.168.50.61
NETMASK=255.255.255.0
GATEWAY=192.168.50.2
DNS1=119.29.29.29
2.1.2 计算节点
[root@compute ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
BOOTPROTO=none
NAME=ens160
DEVICE=ens160
ONBOOT=yes
IPADDR=192.168.50.61
NETMASK=255.255.255.0
GATEWAY=192.168.50.2
DNS1=119.29.29.29
2.2 ip主机名
[root@controller ~]# echo '192.168.50.61 controller' >> /etc/hosts
[root@controller ~]# echo '192.168.50.62 compute' >> /etc/hosts
2.3 NTP时间同步配置
yum -y install chrony
systemctl enable chronyd
chronyc sources
2.4 配置yum源
2.4.1 控制节点
[root@controller ~]# mkdir /etc/yum.repos.d/bak
[root@controller ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/
# 执行以下命令添加 yum 源
cat <<EOF > /etc/yum.repos.d/cloudcs.repo
[highavailability]
name=CentOS Stream 8 - HighAvailability
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/HighAvailability/x86_64/os/
gpgcheck=0
[nfv]
name=CentOS Stream 8 - NFV
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/NFV/x86_64/os/
gpgcheck=0
[rt]
name=CentOS Stream 8 - RT
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/RT/x86_64/os/
gpgcheck=0
[resilientstorage]
name=CentOS Stream 8 - ResilientStorage
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/ResilientStorage/x86_64/os/
gpgcheck=0
[extras-common]
name=CentOS Stream 8 - Extras packages
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/extras/x86_64/extras-common/
gpgcheck=0
[extras]
name=CentOS Stream $releasever - Extras
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/extras/x86_64/os/
gpgcheck=0
[centos-ceph-pacific]
name=CentOS - Ceph Pacific
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/storage/x86_64/ceph-pacific/
gpgcheck=0
[centos-rabbitmq-38]
name=CentOS-8 - RabbitMQ 38
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/messaging/x86_64/rabbitmq-38/
gpgcheck=0
[centos-nfv-openvswitch]
name=CentOS Stream 8 - NFV OpenvSwitch
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/nfv/x86_64/openvswitch-2/
gpgcheck=0
[baseos]
name=CentOS Stream 8 - BaseOS
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/BaseOS/x86_64/os/
gpgcheck=0
[appstream]
name=CentOS Stream 8 - AppStream
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/AppStream/x86_64/os/
gpgcheck=0
[centos-openstack-victoria]
name=CentOS 8 - OpenStack victoria
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/cloud/x86_64/openstack-victoria/
gpgcheck=0
[powertools]
name=CentOS Stream 8 - PowerTools
baseurl=https://mirrors.aliyun.com/centos-vault/8-stream/PowerTools/x86_64/os/
gpgcheck=0
EOF
[root@controller ~]# ls /etc/yum.repos.d/
bak cloudcs.repo
[root@controller ~]# yum clean all
27 files removed
[root@controller ~]# yum repolist all
repo id repo name status
appstream CentOS Stream 8 - AppStream enabled
baseos CentOS Stream 8 - BaseOS enabled
centos-ceph-pacific CentOS - Ceph Pacific enabled
centos-nfv-openvswitch CentOS Stream 8 - NFV OpenvSwitch enabled
centos-openstack-victoria CentOS 8 - OpenStack victoria enabled
centos-rabbitmq-38 CentOS-8 - RabbitMQ 38 enabled
extras CentOS Stream - Extras enabled
extras-common CentOS Stream 8 - Extras packages enabled
highavailability CentOS Stream 8 - HighAvailability enabled
nfv CentOS Stream 8 - NFV enabled
powertools CentOS Stream 8 - PowerTools enabled
resilientstorage CentOS Stream 8 - ResilientStorage enabled
rt CentOS Stream 8 - RT enable
2.4.2 计算节点
[root@compute ~]# mkdir /etc/yum.repos.d/bak
[root@compute ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/
scp /etc/yum.repos.d/cloudcs.repo root@192.168.50.62:/etc/yum.repos.d/
[root@compute ~]# ls /etc/yum.repos.d/
bak cloudcs.repo
2.4.3 安装包(2个节点都需要安装)
# 这个包centos8源里面自带的,然后上面配置的源上也有这个,用我们上面配置的源即可
[root@controller ~]# yum list all | grep centos-release-openstack
centos-release-openstack-train.noarch 2-1.el8 extras
centos-release-openstack-ussuri.noarch 1-5.el8 extras
centos-release-openstack-victoria.noarch 1-2.el8 extras
yum -y install centos-release-openstack-victoria.noarch
2.5 关闭防火墙和selinux,网络
[root@compute ~]# systemctl stop firewalld
[root@compute ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@compute ~]# setenforce 0
[root@compute ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
# 这个网络服务也需要关闭,会与neutron冲突
[root@compute ~]# systemctl stop NetworkManager
[root@compute ~]# systemctl disable NetworkManager
Removed /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
# 如果没有network服务的话,安装
yum -y install network-script
systemctl enable network --now
三、安装配置
控制节点安装packstack工具
[root@controller ~]# yum install -y openstack-packstack
生成应答文件
[root@controller ~]# packstack -h |grep ans
--gen-answer-file=GEN_ANSWER_FILE
Generate a template of an answer file.
--validate-answer-file=VALIDATE_ANSWER_FILE
Check if answerfile contains unexpected options.
--answer-file=ANSWER_FILE
answerfile will also be generated and should be used
-o, --options Print details on options available in answer file(rst
Packstack a second time with the same answer file and
attribute where "y" means an account is disabled.
--manila-netapp-transport-type=MANILA_NETAPP_TRANSPORT_TYPE
The transport protocol used when communicating with
[root@controller ~]# packstack --gen-answer-file=cloudcs.txt
Packstack changed given value to required value /root/.ssh/id_rsa.pub
Additional information:
* Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS plugin. Geneve will be used as the encapsulation method for tenant networks
编辑应答文件
注意设置参数 CONFIG_NEUTRON_OVN_BRIDGE_IFACES ,OVN 会自动创建 br-ex 虚拟交换机并使 ens160 桥接到 br-ex 虚拟交换机上,未来云主机通过 br-ex 可以连通外部网络。
[root@controller ~]# vim cloudcs.txt
#修改以下参数内容
CONFIG_COMPUTE_HOSTS=192.168.50.61,192.168.50.62
CONFIG_KEYSTONE_ADMIN_PW=redhat
CONFIG_PROVISION_DEMO=n
CONFIG_HEAT_INSTALL=y
CONFIG_NEUTRON_OVN_BRIDGE_IFACES=br-ex:ens160
执行应答文件进行安装
[root@controller ~]# packstack --answer-file=cloudcs.txt
Welcome to the Packstack setup utility
The installation log file is available at: /var/tmp/packstack/20230511-170335-nlg10845/openstack-setup.log
Installing:
Clean Up [ DONE ]
Discovering ip protocol version [ DONE ]
root@192.168.100.129's password:
root@192.168.100.128's password:
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 Heat entries [ DONE ]
Preparing Heat CloudFormation API 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 ]
Applying 192.168.100.128_controller.pp
192.168.100.128_controller.pp: [ DONE ]
Applying 192.168.100.128_network.pp
192.168.100.128_network.pp: [ DONE ]
Applying 192.168.100.129_compute.pp
Applying 192.168.100.128_compute.pp
192.168.100.128_compute.pp: [ DONE ]
192.168.100.129_compute.pp: [ DONE ]
Applying Puppet manifests [ DONE ]
Finalizing [ DONE ]
**** Installation completed successfully ******
Additional information:
* Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS plugin. Geneve will be used as the encapsulation method for tenant networks
* 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 192.168.100.128. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://192.168.100.128/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/20230511-170335-nlg10845/openstack-setup.log
* The generated manifests are available at: /var/tmp/packstack/20230511-170335-nlg10845/manifests
四、完成安装
上面的输出信息,一定又要sucessfully才行,否则肯定有组件出现了问题
测试登录

创建一个虚拟机访问外网


注意的点:
# 需要开启这个参数
[root@controller ~]# sysctl -a | grep ip_forward
net.ipv4.ip_forward = 1
# 放行所有流量
iptables -P FORWARD ACCEPT

浙公网安备 33010602011771号