记一次在 openstack 的 openEuler 实例上部署 openstack 并启动一个 openEuler 实例的练习经历(
环境:
openEuler-24.03-LTS-x86_64
4c8g500g -> 8c16g512g (中间爆了一次OOM)
部署前准备 清单
项目
选择
OpenStack
2025.1 Epoxy
Kolla-Ansible
stable/2025.1,20.x
kolla_base_distro
Rocky Linux 9
容器引擎
moby-engine(openEuler自带)
虚拟化
KVM
外部网络
外部网卡只有一个,同时创建无 IP 的 dummy0 占位
Cinder
关闭
HAProxy/Keepalived
关闭
部署模式
All-in-One,即控制节点和计算节点在同一台机器上
1 2 3 4 5 6 7 8 9 10 11 12 13 $ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host noprefixroute valid_lft forever preferred_lft forever 2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether fa:16:3e:8b:a3:5a brd ff:ff:ff:ff:ff:ff inet 192.170.1.249/16 brd 192.170.255.255 scope global dynamic noprefixroute ens3 valid_lft 85033sec preferred_lft 85033sec inet6 fe80::f816:3eff:fe8b:a35a/64 scope link proto kernel_ll valid_lft forever preferred_lft forever
注意事项
不能直接配置:
1 neutron_external_interface: "ens3"
ens3 当前承载 SSH、宿主机地址和默认路由。Neutron 会把外部接口接入 br-ex,直接使用 ens3 很可能导致 SSH 和宿主机网络中断。
解决方法: 创建一个没有 IP 的 dummy0:
1 2 ens3 -> 管理/API/隧道/SSH,保持现状 dummy0 -> Neutron 外部接口占位,接入 br-ex,但不连接物理网络
这样能够完整部署 Keystone、Glance、Placement、Nova、Neutron、Horizon、MariaDB、RabbitMQ 等核心服务,也能创建租户网络和启动虚拟机,但:
虚拟机没有真实外部网络;
Floating IP 不可从物理网络访问;
不运行官方 init-runonce 的外部网络初始化部分;
该占位方案不代表生产网络设计。
openEuler 24.03 不在 Kolla-Ansible 2025.1 官方支持的宿主机列表中 ,会在 precheck 阶段报错。
解决方法: 扩展 Prechecks 的允许列表(后续说明)
建议资源:
资源
最低练习值
建议值
vCPU
4
8
内存
12 GB,仅勉强
24 GB 或更多
系统盘可用空间
80 GB
150 GB 或更多
/var/lib/docker 可用空间
60 GB
100 GB 或更多
如果内存小于 12 GB,不建议继续。4 vCPU 可以部署,但拉镜像、初始化数据库和启动服务会较慢。
备份检查
1 2 3 4 5 6 7 8 9 mkdir -p /root/kolla-backup cp -a /etc/yum.repos.d /root/kolla-backup/yum.repos.d.before-kolla cp -a /etc/NetworkManager /root/kolla-backup/NetworkManager.before-kolla cp -a /etc/hosts /root/kolla-backup/hosts.before-kolla nmcli connection show > /root/kolla-backup/nmcli-connections.txt ip address > /root/kolla-backup/ip-address.txt ip route > /root/kolla-backup/ip-route.txt
1 2 3 4 5 6 ss -lntup systemctl --failed df -hT df -ih ss -lntup | grep -E ':(80|443|3306|5000|5672|6080|6379|8774|8778|9292|9696)\b' || true
1 2 3 4 5 dnf install -y chrony systemctl enable --now chronyd chronyc tracking chronyc sources -v timedatectl
1 2 3 4 dnf repolist -v dnf clean all dnf makecache dnf check-update || true
1 2 3 4 5 6 7 8 9 10 11 12 13 dnf list --available \ docker \ git \ gcc \ python3 \ python3-devel \ python3-pip \ libffi-devel \ openssl-devel \ python3-libselinux \ chrony \ iptables \ NetworkManager
关键依赖安装和配置
1 2 3 4 5 6 7 sed -i \ -e 's#https://repo.openeuler.org#https://repo.huaweicloud.com/openeuler#g' \ -e 's#http://repo.openeuler.org#https://repo.huaweicloud.com/openeuler#g' \ /etc/yum.repos.d/*.repo dnf clean all dnf makecache --refresh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 dnf install -y \ git \ gcc \ make \ python3 \ python3-devel \ python3-pip \ libffi-devel \ openssl-devel \ python3-libselinux \ chrony \ iptables \ iproute \ lvm2 \ NetworkManager \ curl \ wget \ tar
要求 Python >= 3.10
1 2 3 4 5 6 dnf install -y docker systemctl enable --now docker docker version docker info systemctl status docker --no-pager
配置镜像站,后续在 /etc/kolla/globals.yml 中配置
1 2 docker_registry: "quay.nju.edu.cn" docker_registry_insecure: "no"
确认 NetworkManager 正常:
1 2 systemctl enable --now NetworkManager nmcli device status
创建接口:
1 2 3 4 5 6 7 8 nmcli connection add \ type dummy \ ifname dummy0 \ con-name kolla-dummy0 \ ipv4.method disabled \ ipv6.method disabled nmcli connection up kolla-dummy0
1 2 3 4 systemctl disable --now firewalld getenforce systemctl is-active firewalld || true
安装 Kolla-Ansible 创建虚拟环境 1 2 3 4 5 mkdir -p /opt/venvs python3 -m venv /opt/venvs/kolla-2025.1 source /opt/venvs/kolla-2025.1/bin/activate python -m pip install --upgrade pip wheel setuptools
后续执行命令时注意 shell 环境:
1 source /opt/venvs/kolla-2025.1/bin/activate
1 2 3 4 5 6 python -m pip config --site set \ global.index-url \ https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple python -m pip config --site set global.timeout 60 python -m pip config list
安装 Ansible Core 1 2 python -m pip install 'ansible-core>=2.17,<2.19' ansible --version
安装 stable/2025.1 1 2 3 4 python -m pip install \ 'git+https://opendev.org/openstack/kolla-ansible@stable/2025.1' kolla-ansible --version
安装 Galaxy 依赖:
1 2 kolla-ansible install-deps ansible-galaxy collection list
初始化配置
1 2 3 4 5 6 7 8 9 10 11 source /opt/venvs/kolla-2025.1/bin/activate mkdir -p /etc/kolla cp -a \ /opt/venvs/kolla-2025.1/share/kolla-ansible/etc_examples/kolla/. \ /etc/kolla/ cp \ /opt/venvs/kolla-2025.1/share/kolla-ansible/ansible/inventory/all-in-one \ /root/all-in-one
1 2 kolla-genpwd chmod 600 /etc/kolla/passwords.yml
如需指定 Horizon(web控制台) 管理员密码,可修改:
1 keystone_admin_password: "password"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 --- # 容器镜像:openEuler 宿主机使用最接近的 Rocky Linux 9 镜像。 kolla_base_distro: "rocky" kolla_base_distro_version: "9" kolla_container_engine: "docker" # docker 镜像站 docker_registry: "quay.nju.edu.cn" docker_registry_insecure: "no" # AIO 管理/API/隧道网络。 network_interface: "ens3" api_interface: "ens3" tunnel_interface: "ens3" # 本次无真实外部网卡;dummy0 仅满足 Neutron/br-ex 的接口要求。 neutron_external_interface: "dummy0" neutron_bridge_name: "br-ex" neutron_physical_networks: "physnet1" neutron_plugin_agent: "openvswitch" enable_neutron_provider_networks: "no" # 单节点关闭 HAProxy/Keepalived,管理地址直接作为内部 API 地址。 # 必须先通过 DHCP 固定租约保证此地址不会变化。 kolla_internal_vip_address: "< 本机ip >" enable_haproxy: "no" enable_keepalived: "no" # /dev/kvm 已存在。 nova_compute_virt_type: "kvm" # 核心服务。 enable_openstack_core: "yes" enable_horizon: "yes" # 首次练习不启用块存储和重型附加服务。 enable_cinder: "no" enable_cinder_backup: "no" enable_central_logging: "no" enable_prometheus: "no" enable_grafana: "no" enable_heat: "no" enable_octavia: "no" enable_designate: "no" enable_swift: "no" # 使用 openEuler 自带 Docker,不让 bootstrap 添加 Docker CE 仓库。 enable_docker_repo: false docker_yum_package: "moby-engine" # ProxySQL 前端,OpenStack 服务连接这里 database_port: "3306" # MariaDB 后端 (因为启用了enable_haproxy: "no",vip 地址均为本地地址,而默认 ProxySQL 和 MariaDB 都使用3306端口,因此需要修改) mariadb_port: "3307" # 容器日志轮转。 docker_log_max_file: "5" docker_log_max_size: "50m"
openEuler 的 Moby Docker 当前默认使用 journald 日志驱动,但 Kolla 写入了:
1 2 3 4 "log-opts": { "max-file": "5", "max-size": "50m" }
max-file 和 max-size 只适用于 json-file/local 日志驱动,不适用于 journald,所以会导致 Docker 不断启动失败。docker version 连接到 socket 后触发 Docker 自动重启,又一直等不到 daemon 响应,导致在 bootstrap 阶段报错。
解决方法: 在 /etc/kolla/globals.yml 中配置:
1 2 3 4 5 6 7 8 9 10 11 12 enable_docker_repo: false docker_yum_package: "moby-engine" docker_registry: "quay.nju.edu.cn" docker_registry_insecure: "no" docker_log_max_file: "5" docker_log_max_size: "50m" docker_custom_config: log-driver: "json-file" max-concurrent-downloads: 5
注意不要创建重复字段
正式部署 引导程序 1 2 3 4 source /opt/venvs/kolla-2025.1/bin/activate kolla-ansible bootstrap-servers \ -i /root/all-in-one
前置检查
扩展配置文件生成脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 python - <<'PY' import yamlsource = ( "/opt/venvs/kolla-2025.1/share/kolla-ansible/" "ansible/roles/prechecks/vars/main.yml" ) target = "/root/openeuler-prechecks-extra-vars.yml" with open (source, encoding="utf-8" ) as f: original = yaml.safe_load(f) distributions = dict (original["host_os_distributions" ]) distributions["openEuler" ] = [ "24.03" , "24" , "LTS" , "24.03 (LTS)" , ] with open (target, "w" , encoding="utf-8" ) as f: yaml.safe_dump( {"host_os_distributions" : distributions}, f, sort_keys=False , allow_unicode=True , ) print (f"Generated: {target} " )PY
查看生成结果:
1 cat /root/openeuler-prechecks-extra-vars.yml
它应保留 CentOS、Debian、Rocky、Ubuntu 的原始支持列表,并增加:
1 2 3 4 5 openEuler: - '24.03' - '24' - LTS - 24.03 (LTS)
接着使用额外变量重新运行 Prechecks
1 2 3 kolla-ansible prechecks \ -i /root/all-in-one \ -e @/root/openeuler-prechecks-extra-vars.yml
拉取核心镜像 1 2 kolla-ansible pull \ -i /root/all-in-one
部署 1 2 kolla-ansible deploy \ -i /root/all-in-one
部署完成 访问本机 ip 80端口即可进入 Horizon 控制台
总结 此次 AIO 部署仅用于练习,生产环境应考虑:
管理/API、隧道、存储、外部/provider 网络分离;
固定 IP
firewalld/安全组和最小开放端口;
独立 Cinder/Ceph 存储设计;
使用官方支持的 Rocky Linux 或 Ubuntu 宿主机;
…