- 积分
- 16843
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
一、系统环境
% w' C" N: b2 F% X- {' @: a! ?% s3 |root@server:~# cat /etc/lsb-release2 `+ I- Q$ [5 F, }
DISTRIB_ID=Ubuntu E# [" Y7 G; n( }, X: }
DISTRIB_RELEASE=22.04
T0 S6 v( L, P- K* sDISTRIB_CODENAME=jammy
- a2 A; U V5 F8 A: nDISTRIB_DESCRIPTION="Ubuntu 22.04.5 LTS"% ]+ i, T& v4 c$ T
* V4 _% d" S" |' ?5 B6 ]
root@server:~# python3 --version" p+ s" m* q% P: g/ r( Z$ n. D
Python 3.10.12
. w1 J4 P# P' `+ s2 n9 e& L% @& A: A- ^; [3 ?, H# x/ T& H
root@server:~# pip --version! @1 q5 q5 r0 S* t
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
& y- G. A# Y9 Z: |$ E5 _( k! v% Z' H3 a0 I3 U" S6 T
root@server:~# pip3 --version/ }9 a, a9 k K3 t& ~
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10); j7 Z1 s) b$ m. O# @; A
, b& ~( w/ f8 K( Y
root@server:~# docker --version* q9 O) A. U2 v8 W' d0 M
Docker version 27.2.1, build 9e34c9b
+ X4 N& t5 A. ^- P3 i6 A 最小硬件要求9 w. q: b1 z) l6 }& [3 I) |
9 Z$ K* {; u6 k+ r+ F! O
2 network interfaces
. ^; n D, k! k) |! ^# O
: s0 a- [. u4 N3 P( m5 Z2 A8GB main memory5 }' v& K0 W' d; ^
4 B- Y& T# ^7 b- k0 b7 T- T
40GB disk space1 d" ]9 U4 y r m. F) l* Y0 H! `
二、openstack版本时间列表
2 b" t/ M+ F. |) T0 H) }. `请阅览
5 b8 X. o/ |7 S官方文档:OpenStack Releases: OpenStack Releases
7 n p6 h+ X6 o7 c2 P
" D+ y/ O. ~9 B# P三、安装步骤- K6 K0 X8 w( p5 T
1、更新安装源
# p& e7 R; o6 W% J; j2 A' \sudo apt update( }! F% l L" @2 Y, g* g5 s# A
2、安装python依赖库& t7 ?( B/ h# C1 D2 b
sudo apt install git python3-dev libffi-dev gcc libssl-dev -y$ m v- O+ l) v
*在第二步安装完成后,官方文档建议使用python虚拟环境
9 [. w; q2 p4 |6 ~. c0 J) l+ z* m$ `
python3-venv
$ Q4 e3 L" Y6 [5 d. Z# }! W& r实际安装中,启用虚拟环境会出现一些文件和依赖库找不到的情况,有科学上网的情况下不使用python虚拟环境更容易成功。: ~. f* D' `9 }1 J/ r( S
3、更新Pip
5 Q6 ~0 d5 j9 p& t; b; \( c' _pip install -U pip: F* T* l6 \4 U% u& l
4、安装ansible,*此步有版本兼容要求 ,详细查看官方文档
+ l/ j& a) [$ O: {2 D! o) r% npip install 'ansible-core>=2.14,<2.16'
+ H4 p8 U- g9 E4 R0 J8 b
3 a$ i2 U! v/ a2 }7 ^5、 安装kolla-ansible,*有科学上网速度更快,更易成功。- m* w% o- L9 E+ _7 }
pip install git+https://opendev.org/openstack/kolla-ansible@stable/2023.2' I, |4 i( C1 D0 ^2 Y
验证
% y4 s/ x# a) o( G# U# Y
9 p z4 q# ?& b2 O0 n6 |root@server:~# kolla-ansible --version# I! O" Q- I' L+ G) b
17.5.1
4 b( F2 P; u' T9 N
5 T! E1 o4 W; g! J+ |5 A0 F# }6、创建/etc/kolla目录) v {! ^. U, b- H* v
sudo mkdir -p /etc/kolla7 A, _ O0 a" Z/ U2 \1 S
sudo chown $USER:$USER /etc/kolla
: _" M+ z/ F/ P% h 7、复制globals.yml和passwords.yml至/etc/kolla目录。+ ]# x8 Q; H" e, t, `
cp -r /usr/local/share/kolla-ansible/etc_examples/kolla/* /etc/kolla
7 @' ?. }, X' c( r# `+ X- n) z) W% Z) Y- Q0 l5 l( s
8、将存文件all-in-one复制到当前目录
) J+ t" Z M l4 d$ Ycp /usr/local/share/kolla-ansible/ansible/inventory/all-in-one .* z; X1 ~# y% w4 d6 Z3 b
9、安装 Ansible Galaxy 依赖项( E: o. V! a1 u+ l( u
kolla-ansible install-deps
0 V) S& p! z* C8 |1 f10、准备初始配置
; |4 f4 L- o Hkolla-genpwd
; j3 \7 K( J, F2 l$ S. Y* d 此命令会自动在/etc/kolla/passwords.yml文件中生成需用到的密码,手动改成我们容易记忆的密码( ]' D6 f+ A6 V1 @' f7 u( f3 c
- g3 F, W' O5 e I* h6 K8 M* b/ W! ~$ i
vim /etc/kolla/passwords.yml
0 ?1 Y8 e. y' ^5 a; |4 R" A ironic_database_password: OP51scqsHjnnhyrcNP78EgrueWfCZqLsWsAxr6vY
1 I6 z/ g! b( n: X' ]8 l Dironic_inspector_database_password: wFGxG2AGUObjFfAgjTik6xKyy45u1q82wJaM9Cpa
4 t3 d) @. Q u" _9 z5 X, Y9 Jironic_inspector_keystone_password: 3oO8YGp0C3lLdCWe9po2KlLuLUtZAlbDS5grxAjn7 Y3 @8 }. ]4 O9 l% W# A/ r i: e
ironic_keystone_password: LnnnShk6HEM8THNgGrng9wqVFzFGtKNSIIzCfYMd! }4 R4 N; ^% Q; v* N
keepalived_password: NzQGRdKBrw3WP9FFbAG0cwHpUNpDMEUolzEWn2Dm" a) T- o" d7 L# B4 w
keystone_admin_password: 【登入密码】例如:root1234.) z& E# g- M! h% c6 _ Q
keystone_database_password: xaYRCMsOtfPBs27upLeeC8Ve2VuZcmhuKEXvxXFE, C3 O0 X# |% B& @2 G2 @
keystone_federation_openid_crypto_password: U5q5RIrkZawlGtR0sgHWWMYjO36UJtPWBPnC1vx2+ O- N4 ?" h9 ?* ]3 a4 u/ D' t, h$ O
: G" V0 S+ B( p; o1 o修改/etc/kolla/globals.yml文件
/ `/ t I) W: D# ?6 ]7 \" P/ ^2 M$ Q3 d% B# p
vim /etc/kolla/globals.yml0 {* [3 v' I* L+ ]: U- m" p y
网络部分:) T' y: x8 v; r7 E8 S/ Z
9 f! e' ~3 z [$ ` ?3 R5 n#**********' X q# I8 T: H
kolla_internal_vip_address: "192.168.8.88"
0 B1 B0 m1 r2 I c' ~ \/ r- M. u" O9 b. @
#**************# m* y1 O- j8 J
network_interface: "ens160"
2 Y V6 j3 @! C% Q: h: m& U% L' k5 P4 g% d5 l+ D+ V% T/ k5 @
neutron_external_interface: "ens190") F, r0 q' [& x M
*network_interface设备正常连接,并配IP4可正常上网和科学上网,和192.168.8.88在同一网段。 * W( |6 W; d0 |& U. [' N
% u8 U* Y2 R5 a+ p! Y, Z% @/ q
*neutron_external_interface 设备为启用,但不连接状态% r* H: ]) k. G% V4 l5 E
/ n. E7 a' |+ a. ?
启用裸金属配置) Y0 k: n) p# w/ [5 m0 C6 S6 b7 b
' E. y2 i } D% P: x
#enable_influxdb: "{{ enable_cloudkitty | bool and cloudkitty_storage_backend == 'influxdb' }}" j- T8 R% X, _1 |! ?, ^
enable_ironic: "yes"- ~1 W5 b! ?# l q/ {) k% Y6 R
#enable_ironic_neutron_agent: "{{ enable_neutron | bool and enable_ironic | bool }}"
9 o2 V% a+ F: e5 Q2 n 裸金属配置部分
4 V. W( ~ W& j6 ~7 Y
& U2 Z/ W/ U; {! Y$ \( ^#############################
" @* L, q' e1 E% l; H& {, M! Q, L# Ironic options
& D$ M8 H/ O1 R3 }. ~#############################' \/ g. E, H3 T% _; V# ?
# dnsmasq bind interface for Ironic Inspector, by default is network_interface7 ~* l: Y3 {' H- g+ o9 K: c
#ironic_dnsmasq_interface: "{{ network_interface }}"
4 r y6 ]4 E1 X& V' g0 Aironic_cleaning_network: "public1"5 K4 F* V- f. H: I, B# I
# The following value must be set when enabling ironic, the value format is a t% ^. i4 Z1 @$ M: o2 s
# list of ranges - at least one must be configured, for example:; e$ N: _& s2 q) [* d8 ]/ @
# - range: 192.168.0.10,192.168.0.100
/ x! w: f$ W. ~- @- F# See Kolla Ansible docs on Ironic for details.
' ?0 e0 w8 Q3 M" x#ironic_dnsmasq_dhcp_ranges:5 f' ^% Q0 d( m; I
# PXE bootloader file for Ironic Inspector, relative to /var/lib/ironic/tftpboot.& y7 q# s( ]4 o, [6 I
#ironic_dnsmasq_boot_file: "pxelinux.0"" ?9 R7 C: j9 Z3 c' X( U
% d5 B' i* x2 ` Q- B( X4 @/ K9 B
# PXE bootloader file for Ironic Inspector, relative to /tftpboot.
8 h2 Y8 A; W4 E* x& Z2 I1 y, _2 fironic_dnsmasq_dhcp_ranges:
2 T. M( R w4 \ - range: "192.168.6.100,192.168.6.120,255.255.255.0"
4 l' W. N5 c0 n! o% b$ y routers: "192.168.6.1"6 L5 G- x1 n/ P) L
# # PXE bootloader file for Ironic Inspector, relative to /tftpboot.7 H4 g6 f5 e1 M. e0 m
ironic_dnsmasq_boot_file: "pxelinux.0"3 V4 @; s* ~, u# C0 m
ironic_cleaning_network: "public1"
4 C' X% H4 E/ J v% Uironic_dnsmasq_default_gateway: 192.168.6.1
* S1 b' {! l" Z/ f" x. z11、 带有 kolla 部署依赖项的引导服务检查
: O* L' l- U6 I/ [4 c7 f9 X1 kkolla-ansible -i ./all-in-one bootstrap-servers
' h7 O1 J1 V! x此过程中,可能遇到的问题
9 o/ ]* a0 f4 Z( \( Q' R& Z2 p# j0 r+ ]6 |8 A
1、无法下载docker gpg key文件
1 `6 p1 Z4 }+ \+ h7 L
! y2 ?% @: ^8 a$ V0 \3 E/ KTASK [openstack.kolla.docker : Install docker apt gpg key] ******************************************************************************************************************************************************5 o/ Q/ k& } y! G
fatal: [localhost]: FAILED! => {"changed": false, "dest": "/etc/apt/keyrings/docker.asc", "elapsed": 0, "msg": "Request failed: <urlopen error [Errno 104] Connection reset by peer>", "url": "https://download.docker.com/linux/ubuntu/gpg"}
( u$ f& c4 y' C% ?
$ ]: ?6 F4 K+ a( o3 _# i; |* VPLAY RECAP ******************************************************************************************************************************************************************************************************/ b* D L- I: A
localhost : ok=15 changed=4 unreachable=0 failed=1 skipped=4 rescued=0 ignored=0 . G# k7 \9 |9 Q7 F, k" ?
kolla-ansible无法安装docker官网的gpg文件,可用科学上网或是代理方法手工导入。例如
. L: i/ x& D/ \( I' l
" I4 K! S w* y2 Rcurl -x http://103.41.117.2:912 -U username:password -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -$ w0 J8 ]1 g7 v! |3 @8 a
2、设置apt repository错误
/ `, f/ u; B+ r1 D& C3 S; c6 B+ T/ }$ ~. w- i0 E" l, k
TASK [openstack.kolla.docker : Enable docker apt repository] ****************************************************************************************************************************************************1 E6 S4 W, y1 {$ B5 y
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: apt_pkg.Error: E:Conflicting values set for option Signed-By regarding source https://download.docker.com/linux/ubuntu/ jammy: /usr/share/keyrings/docker-archive-keyring.gpg != /etc/apt/keyrings/docker.asc, E:The list of sources could not be read.1 C! ]7 c4 d! u6 J* k' h
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1726959353.5827672-18889-136818767683024/AnsiballZ_apt_repository.py\", line 107, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1726959353.5827672-18889-136818767683024/AnsiballZ_apt_repository.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1726959353.5827672-18889-136818767683024/AnsiballZ_apt_repository.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible.modules.apt_repository', init_globals=dict(_module_fqn='ansible.modules.apt_repository', _modlib_path=modlib_path),\n File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_apt_repository_payload_hw0whgee/ansible_apt_repository_payload.zip/ansible/modules/apt_repository.py\", line 765, in <module>\n File \"/tmp/ansible_apt_repository_payload_hw0whgee/ansible_apt_repository_payload.zip/ansible/modules/apt_repository.py\", line 742, in main\n File \"/usr/lib/python3/dist-packages/apt/cache.py\", line 152, in __init__\n self.open(progress)\n File \"/usr/lib/python3/dist-packages/apt/cache.py\", line 214, in open\n self._cache = apt_pkg.Cache(progress)\napt_pkg.Error: E:Conflicting values set for option Signed-By regarding source https://download.docker.com/linux/ubuntu/ jammy: /usr/share/keyrings/docker-archive-keyring.gpg != /etc/apt/keyrings/docker.asc, E:The list of sources could not be read.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}- U- Q4 |$ P# j8 J
科学上网可以解决,或者可以手工导入docker官方源/ |3 G- \4 k4 n
9 Q9 X6 H' T7 C6 K+ c; f5 q1 U; `
sudo tee /etc/apt/sources.list.d/docker.list <<EOF
3 E* }2 o( H- h3 ?4 r: V( ~# adeb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable
- q1 Z1 E1 @3 ^$ qEOF% g! u* t" N6 F" `
12、对主机进行部署前检查& [% p1 f* H4 }9 b
kolla-ansible -i ./all-in-one prechecks
/ @ h! X) o) }2 b" Y+ g) Z I 13、实际的OpenStack部署
0 y1 \8 Z- H7 k/ k4 N5 Y' tkolla-ansible -i ./all-in-one deploy+ t6 J: G5 S5 {; R3 Z3 [
部署成功后,裸金属向导界面为 ?. k& W3 u, s, X7 F1 @
6 f9 b) R! Z4 a3 z! p* m0 H& {. }2 Q! q1 J$ Y' x; D# f0 I$ G3 N* ^
% L( \/ i F+ Z4 _2 ]1 h注册节点驱动属性增加http下载, Y. F" i0 N1 @2 Q
0 A" a; a4 \3 N% k2 G' T5 G! o) ]; `- c+ h" S7 O9 a t
7 ~8 x8 \9 r) f/ D: |0 m6 v) u( Y& J% Q: |; \' h) I f2 |, v
4 z7 ~4 h! \' K
四、其他问题
! L2 ^! m5 E0 ~* ?1 e1、部署出问题时,摧毁所有系统配置。) R( ^* a( w) A; p: O
kolla-ansible destroy -i ./all-in-one --yes-i-really-really-mean-it) O& e+ t5 u3 x/ G. J2 }6 o0 Q8 ]& u
5 R p9 g9 Q4 k3 }. {2、安装CLI客户端) p8 G3 K( c% m% |; a+ m4 {4 V" ?
pip install python-openstackclient -c https://releases.openstack.org/constraints/upper/2023.2
% _; t1 N5 c- V/ l: \$ [" B
) b% V2 m7 A% A* ^% e. y3、生成管理员认证访问凭据文件
% \5 [, O l: w/ G: t, i$ lkolla-ansible post-deploy. O5 d! Z3 b* h3 E) w/ o) \+ u
3 p" y! }3 `! T- @3 Xcp /etc/kolla/admin-openrc.sh .
/ S7 M1 ~( Z! m, N# U8 t 使用CLI访问时,可先启用
( E8 _/ b. l, P, i( k4 N% K
- R/ h+ Q& b& a- J0 L2 t. admin-openrc.sh3 l" k2 a/ C0 b& l7 ?9 e4 W3 n. V
运行测试
2 v7 M7 E3 |& k7 S" j# K+ m4 g( q
root@odoo16e-server:~# . admin-openrc.sh. q" F% ]! Y. h$ M/ l# M
root@odoo16e-server:~# openstack compute service list8 ]/ b6 W3 g3 G* h$ O( W
+--------------------------------------+----------------+-----------------------+----------+---------+-------+----------------------------+
8 D! d9 I4 d1 D c0 s! P/ u| ID | Binary | Host | Zone | Status | State | Updated At |
; ~$ c1 A8 j3 ?+--------------------------------------+----------------+-----------------------+----------+---------+-------+----------------------------+
1 J y, m, P; ~8 s| 67f25603-5d6e-4327-a9d2-b0fd341876f3 | nova-conductor | odoo16e-server | internal | enabled | up | 2024-09-19T03:31:17.000000 | P0 h9 [. Y' J( _8 b+ x
| f49326e1-1608-4546-bed0-123dd2e52af8 | nova-compute | odoo16e-server | nova | enabled | up | 2024-09-19T03:31:13.000000 |. V u% y$ `+ a
| b26f35c0-bb02-4151-8df4-e30d65eb6e4a | nova-compute | odoo16e-server-ironic | nova | enabled | up | 2024-09-19T03:31:19.000000 |
* H3 U s3 P% ^| 9b988858-bcbf-4fce-8b55-c0c01e30a463 | nova-scheduler | odoo16e-server | internal | enabled | up | 2024-09-19T03:31:19.000000 |
' j! L: a d5 H) L3 b7 l( V1 |+--------------------------------------+----------------+-----------------------+----------+---------+-------+----------------------------+
3 g" D. Q+ K8 ]- }" N
; B/ \6 q1 k" g+ ~6 r" w3 }8 n
7 n# ?9 |6 n6 z5 g |
|