赞
踩
因为之前已经在 Ubuntu 20.04 下完成了 Ubuntu 20.04 手动安装OpenStack ,最后,想要学习 OVN 的时候,发现 ubuntu 上的 OVN 安装很复杂,没有 TripleO/RDO based deployments ,所以,又在 CentOS 7.9 上完成了一次 OpenStack Controller 安装
1 个 Hyper-V 虚拟机
Controller (CentOS 7.9)
管理者网卡( Management ): 192.168.0.145
公网提供者网卡 ( Provider ): 203.0.113.145
依然使用之前模拟的 203.0.113.1 网关
Ubuntu 18.04 通过 ufw route 配置网关服务器
抱歉!大部分内容从之前抄写过来的
来回失败的尝试,死活 ping 不通 route 的地址 (203.0.113.XX)
习惯性的以为 Networking 部分配置不对,于是在
Install and configure for Ubuntu 这里打转转,甚至折腾了好久 OVN Install Documentation
无奈又无聊的时候,翻看文档
原文抄录如下:
**Management on 10.0.0.0/24 with gateway 10.0.0.1
This network requires a gateway to provide Internet access to all nodes for administrative purposes such as package installation, security updates, DNS, and NTP.
Provider on 203.0.113.0/24 with gateway 203.0.113.1
This network requires a gateway to provide Internet access to instances in your OpenStack environment.**
终于恍然大悟!问题出在网关(gateway)!
这个 Provider 在以前版本叫 Public ,开始总是半知半解,把 2 个单词加一起理解比较好
学习中不可能有实际公网地址和网关给我们使用,所以,模拟一个 203.0.113.0/24 网关
如果不想单独用一个虚拟机作为网关,可以在 Controller 增加第三个网卡来模拟
总之,要想最终可以 ping 通路由器和虚拟机的浮动地址,开始时就需要预备好网关
在 Controller 和 Compute1 服务器上, ping 通203.0.113.1
学习过程中所有的密码设置为同一个,例如: secret
Host networking按照前面修改为自己的 IP
OpenStack packages for RHEL and CentOS
这里列举了所有版本的 OpenStack repository ,但是,实际上对应 CentOS 7 只有可怜的几个
[root@localhost ~]# yum list centos-release-openstack*
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.aliyun.com
可安装的软件包
centos-release-openstack-queens.noarch 1-2.el7.centos extras
centos-release-openstack-rocky.noarch 1-1.el7.centos extras
centos-release-openstack-stein.noarch 1-1.el7.centos extras
centos-release-openstack-train.noarch 1-1.el7.centos extras
查询 OpenStack的历史版本,发现 train 才是这其中的最新版,原来我还傻傻的以为列表的第一个 queen 版本最新!
抄写一下对应的步骤
# yum install centos-release-openstack-train
# yum install https://rdoproject.org/repos/rdo-release.rpm
# yum upgrade
# yum install python-openstackclient
# yum install openstack-selinux
Install OpenStack services
如图所示,建议安装到 Networking service – neutron installation for Xena 之前,
再做一个快照!
再做一个快照!
再做一个快照!
安装完 Networking service – neutron installation for Xena 之后,
再做一个快照!
再做一个快照!
再做一个快照!
还有一个 network bridge filters 需要设置
vim /etc/sysctl.conf
增加
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
必须先加载模块 br_netfilter
modprobe br_netfilter
应用生效
sysctl -p /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
因为完全单独安装完成 Controller ,所以验证这里会缺少一项 compute1,只有 4 条
[root@controller ~]# openstack network agent list
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| ID | Agent Type | Host | Availability Zone | Alive | State | Binary |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
| 7208479a-62e5-44d9-9ad8-3aa393973949 | Linux bridge agent | controller | None | :-) | UP | neutron-linuxbridge-agent |
| 9a065e95-3bf0-48f7-9605-7766311e78da | DHCP agent | controller | nova | :-) | UP | neutron-dhcp-agent |
| a01323eb-19a6-4446-8d05-e7fe4b3f7d3e | L3 agent | controller | nova | :-) | UP | neutron-l3-agent |
| f7c78cc7-ee8e-4949-840f-af9d70da6c5e | Metadata agent | controller | None | :-) | UP | neutron-metadata-agent |
+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+
不要着急进入 : Dashboard
跳到下一步 : Launch an instance
如果担心后续虚拟机 ping 不通外网,可以修改 8.8.4.4 为 114.114.114.114 等国内 DNS
创建公网提供者(provider)网络和子网
Provider network
抄录一下 3 条命令
$ . admin-openrc
$ openstack network create --share --external \
--provider-physical-network provider \
--provider-network-type flat provider
$ openstack subnet create --network provider \
--allocation-pool start=203.0.113.101,end=203.0.113.250 \
--dns-nameserver 8.8.4.4 --gateway 203.0.113.1 \
--subnet-range 203.0.113.0/24 provider
创建私有网络(selfservice)网络和子网
Self-service network
抄录一下 3 条命令
$ . demo-openrc
$ openstack network create selfservice
$ openstack subnet create --network selfservice \
--dns-nameserver 8.8.4.4 --gateway 172.16.1.1 \
--subnet-range 172.16.1.0/24 selfservice
创建路由器(router)
抄录一下 4 条命令
$ . demo-openrc
$ openstack router create router
$ openstack router add subnet router selfservice
$ openstack router set router --external-gateway provider
验证网络连通性
1). root@controller:/home/dhbm# source admin-openrc
2). root@controller:/home/dhbm# ip netns
qrouter-f6a53f5b-104a-4840-bd67-db6b5a51d6dd (id: 2)
qdhcp-1c17dcdc-ab9a-4324-8dc0-e5a21515323d (id: 0)
qdhcp-dcda4686-434c-409c-8de4-134eafdbe939 (id: 1)
3). root@controller:/home/dhbm# openstack port list --router router
+--------------------------------------+------+-------------------+------------------------------------------------------------------------------+--------+
| ID | Name | MAC Address | Fixed IP Addresses | Status |
+--------------------------------------+------+-------------------+------------------------------------------------------------------------------+--------+
| 32127872-6154-44d0-b52d-5408fe659528 | | fa:16:3e:14:b6:32 | ip_address='172.16.1.1', subnet_id='c0a15e76-3694-4b61-9101-71a9aed1e7b0' | ACTIVE |
| fe315fd4-9014-43f0-a64f-472758ac305f | | fa:16:3e:c5:a5:e9 | ip_address='203.0.113.198', subnet_id='eac59d6f-a533-424d-bb22-8bc504acf773' | ACTIVE |
+--------------------------------------+------+-------------------+------------------------------------------------------------------------------+--------+
4). root@controller:/home/dhbm# ping 203.0.113.198
PING 203.0.113.198 (203.0.113.198) 56(84) bytes of data.
64 bytes from 203.0.113.198: icmp_seq=1 ttl=64 time=0.090 ms
64 bytes from 203.0.113.198: icmp_seq=2 ttl=64 time=0.065 ms
64 bytes from 203.0.113.198: icmp_seq=3 ttl=64 time=0.076 ms
......
后悔药 (反向删除以上 2 个 network 和 router)
openstack router remove subnet router selfservice
openstack router delete router
openstack subnet delete selfservice
openstack network delete selfservice
openstack subnet delete provider
openstack network delete provider
本文不再继续安装 openstack-dashboard
本来是准备用来学习 OVN 的,到这里才发现 train (以及更早)版本,不支持 OVN ,文档中就没有,究其原因,可能是因为老版本还都是 python 2 ,新版本都是 python 3
之前的 compute1 是 ubuntu 20.04 安装的 XENA 版本的 nova 计算节点
openstack compute service list 找不到 compute1
openstack network agent list 可以看到 compute1
查看日志
root@compute1:/home/dhbm# tail /var/log/nova/nova-compute.log
2022-11-24 08:23:02.666 1918 ERROR nova File "/usr/lib/python3/dist-packages/nova/scheduler/client/report.py", line 231, in _create_client
2022-11-24 08:23:02.666 1918 ERROR nova client = self._adapter or utils.get_sdk_adapter('placement')
2022-11-24 08:23:02.666 1918 ERROR nova File "/usr/lib/python3/dist-packages/nova/utils.py", line 984, in get_sdk_adapter
2022-11-24 08:23:02.666 1918 ERROR nova return getattr(conn, service_type)
2022-11-24 08:23:02.666 1918 ERROR nova File "/usr/lib/python3/dist-packages/openstack/service_description.py", line 87, in __get__
2022-11-24 08:23:02.666 1918 ERROR nova proxy = self._make_proxy(instance)
2022-11-24 08:23:02.666 1918 ERROR nova File "/usr/lib/python3/dist-packages/openstack/service_description.py", line 266, in _make_proxy
2022-11-24 08:23:02.666 1918 ERROR nova raise exceptions.NotSupported(
2022-11-24 08:23:02.666 1918 ERROR nova openstack.exceptions.NotSupported: The placement service for controller:RegionOne exists but does not have any supported versions.
2022-11-24 08:23:02.666 1918 ERROR nova
看来,如果实际使用 OpenStack 的话,一定保证 controller 节点和 compute 节点的软件版本一致!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。